综上所属:
scrollView内部的子控件的约束必须完整
代码如下:
- (UIScrollView *)hScrollerView{
if (!_hScrollerView) {
_hScrollerView = [[UIScrollView alloc] init];
_hScrollerView.pagingEnabled = YES;
_hScrollerView.showsHorizontalScrollIndicator = YES;
}
return _hScrollerView;
}
添加约束:
[self.hScrollerView addSubview:self.passwordLoginBackView];
[self.hScrollerView addSubview:self.noPasswordLoginBackView];
[self.hScrollerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.segement.mas_bottom);
make.left.right.bottom.equalTo(self);
}];
[self.passwordLoginBackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.equalTo(self.hScrollerView);
make.width.height.equalTo(self.hScrollerView);
}];
[self.noPasswordLoginBackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.passwordLoginBackView.mas_right);
make.top.right.bottom.equalTo(self.hScrollerView);
make.width.height.equalTo(self.hScrollerView);
}];