我有一个滚动视图和一个位于其后面的图像视图,我正在使用nibs填充它们。我正在使用自动布局。这两个视图都有底部和顶部与父视图的间距。图像视图正好实现了我想要的效果。对于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];
据我所见,这只是将视图中的所有限制都移除了。而这并不是我想要的。