水平并排布局,自动适应宽度,适合多view布局。
//水平方向等间隔布局
//Spacing:间隔距离
//leadSpacing:距离最左面
//tailSpacing:距离最右面
[imageArray mas_distributeViewsAlongAxis:MASAxisTypeHorizontal
withFixedSpacing:widthSU*15
leadSpacing:widthSU*31
tailSpacing:widthSU*65];
[imageArray mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self->title.bottom).with.offset(heightSU*16);
make.height.equalTo(heightSU*118);
}];
竖直方向布局,自动计算高度。
//竖直方向等间隔布局 MASAxisTypeVertical
//水平方向等间隔布局 MASAxisTypeHorizontal
//Spacing:间隔距离
//leadSpacing:距离最上面
//tailSpacing:距离最下面
[listArray mas_distributeViewsAlongAxis:MASAxisTypeVertical
withFixedSpacing:0
leadSpacing:0
tailSpacing:heightSU*152];
[listArray mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).with.offset(heightSU*47);
make.right.equalTo(self).with.offset(-heightSU*37);
// make.height.equalTo(heightSU*94);
}];
读取plist文件
[[NSArray alloc]initWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"cityGroups" ofType:@"plist"]];
网友评论