iOS Masonry 在ScrollerView 自动设置ContentSize

- (void)viewDidLoad {

[superviewDidLoad];

UIScrollView* sss = [UIScrollViewnew];

[self.viewaddSubview:sss];

sss.backgroundColor= [UIColorpurpleColor];

[sssmas_makeConstraints:^(MASConstraintMaker*make) {

make.edges.insets(UIEdgeInsetsMake(10,10,10,10));

}];

UIView* contentView = [UIViewnew];

[sssaddSubview:contentView];

contentView.backgroundColor= [UIColoryellowColor];

[contentViewmas_makeConstraints:^(MASConstraintMaker*make) {

make.edges.equalTo(sss);

make.width.equalTo(sss);

}];

UIView* redView = [UIViewnew];

redView.backgroundColor= [UIColorredColor];

[contentViewaddSubview:redView];

[redViewmas_makeConstraints:^(MASConstraintMaker*make) {

make.centerX.mas_equalTo(contentView);

make.width.height.mas_equalTo(300);

make.top.offset(100);

}];

UIView* blueView = [UIViewnew];

blueView.backgroundColor= [UIColorblueColor];

[contentViewaddSubview:blueView];

[blueViewmas_makeConstraints:^(MASConstraintMaker*make) {

make.centerX.mas_equalTo(contentView);

make.width.height.mas_equalTo(300);

make.top.offset(1220);

make.bottom.mas_equalTo(contentView).offset(-20);

}];

}

你可能感兴趣的:(iOS Masonry 在ScrollerView 自动设置ContentSize)