UIScrollView不使用autolayout约束我在后面有一个滚动视图和一个图像视图,我正在用nib填充它。我用的是自动收费表。在这两个视图中,我都有一个底部空间到SuperView,还有一个到SuperView的顶部空间。图像视图实现了我想要它做的事情。对于iPhone 5,它是我想要的地方。而对于其他iPhone,它保持在屏幕底部上方,因此它的大小是正确的。滚动视图在iPhone 5上看起来是对的,但在其他手机上它没有调整大小,所以它向下滚动到应用程序的视图下方。我在日志中得到了这些信息: 2012-11-21 10:42:38.576 LCHApp[12604:907] Unable to simultaneously satisfy constraints.Probably at least one of the constraints in the following list is one you don't want.
Try this: (1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer
to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) "<NSLayoutConstraint:0x1d8ea080 UIScrollView:0x1d8413b0.bottom == UIImageView:0x1d892110.bottom>","<NSAutoresizingMaskLayoutConstraint:0x1d8cca10 h=-&- v=-&- ScheduleViewNib:0x1d853630.height == UIScrollView:0x1d8413b0.height - 386>","<NSLayoutConstraint:0x1d8e5340 V:[UIImageView:0x1d892110]-(64)-| (Names: '|':ScheduleView:0x1d8efc30 )>","<NSAutoresizingMaskLayoutConstraint:0x1d8cf520 h=--& v=--& V:[ScheduleView:0x1d8efc30(480)]>","<NSLayoutConstraint:0x1d8eaed0 V:|-(45)-[UIScrollView:0x1d8413b0] (Names: '|':ScheduleView:0x1d8efc30 )>"
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1d8ea080 UIScrollView:0x1d8413b0.bottom == UIImageView:0x1d892110.bottom>我已经试过了[self setTranslatesAutoresizingMaskIntoConstraints:YES];和[self.myScrollView setTranslatesAutoresizingMaskIntoConstraints:YES];从我所能看到的情况来看,这只是去掉了视图中的所有约束。也不是我想要的
3 回答
慕丝7291255
TA贡献1859条经验 获得超6个赞
[scrollView addConstraint:[NSLayoutConstraint constraintWithItem:lastSubView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:scrollView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]];
- 3 回答
- 0 关注
- 406 浏览
添加回答
举报
0/150
提交
取消