在iOS 8/Xcode 6 GM Seed上使用autolayout大小时,UIScrollView会中断

 林秋伟左婷_894 发布于 2022-12-22 09:39

如何使用自动布局来计算其内容大小?

每当Scroll视图(带有Autolayout)存在时,Xcode 6似乎会创建一个"UIView Encapsulated Layout Height"约束,并且此约束将强制将高度设置为帧高度(从而使滚动视图的滚动功能无效).

布局破碎 -  Xcode 6 GM Seed中的iPhone 5s模拟器

错误:

2014-09-09 21:06:01.059 ScrollViewLayoutBreaking[24488:88731] 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) 
(
    "",
    "",
    "",
    "",
    "",
    "<_UILayoutSupportConstraint:0x7f9a19ea0ac0 V:[_UILayoutGuide:0x7f9a19ec18d0(0)]>",
    "<_UILayoutSupportConstraint:0x7f9a19ea7380 V:|-(0)-[_UILayoutGuide:0x7f9a19ec18d0]   (Names: '|':UIScrollView:0x7f9a19ea76a0 )>",
    "<_UILayoutSupportConstraint:0x7f9a19e21d00 V:[_UILayoutGuide:0x7f9a19ec2260(0)]>",
    "<_UILayoutSupportConstraint:0x7f9a19e8a930 _UILayoutGuide:0x7f9a19ec2260.bottom == UIScrollView:0x7f9a19ea76a0.bottom>",
    ""
)

Will attempt to recover by breaking constraint 


Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in  may also be helpful.

编辑:此滚动视图中的所有视图都是自动循环的,并已固定到滚动视图的顶部和底部以及两侧.我知道未能在所有四个方面绑定它将无法创建内容大小.iOS 7/XCode 5中的自动布局和滚动是正确的,但iOS 8/XCode 6中完全相同的代码和故事板中断.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有