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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM