IOS Masonry+UIScrollView出现的问题

问题:UIScrollView上有子视图超出界面外需要滑动全面预览

解决方法:scrollView的最后一个子控件要加上 make.bottom.equalTo(scrollView.mas_bottom);

[self addSubview:self.scrollView];
...
[self.scrollView addSubview:self.botomView];
//
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.left.right.equalTo(self);
           make.bottom.equalTo(self);
    }];
...
//botomView为最后一个字控件
self.botomView.backgroundColor = [UIColor redColor]; [self.botomView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.scrollView); make.top.equalTo(self.radarChartView.mas_bottom); make.left.equalTo(self.scrollView.mas_left).offset(50); make.height.mas_equalTo(200); make.bottom.equalTo(self.scrollView.mas_bottom).offset(-20); }];

 以上为示例

参考网址:https://www.jianshu.com/p/d18140eb2251

猜你喜欢

转载自www.cnblogs.com/wusang/p/12809558.html