码迷,mamicode.com
首页 > 其他好文 > 详细

使用autolayout常见错误

时间:2014-12-20 10:24:34      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

使用autolayout常见错误

1:The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x8e82e40 UISearchBar:0x8e7fa80.top == UIView:0x8b7c510.top + 20>
    When added to a view, the constraint‘s items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.

这个错误是创建完searchBar以后要马上添加到当前view中,否则添加约束的时候就会有警告。把红线圈住的代码移动到箭头所指的地方就行。

技术分享

使用autolayout常见错误

标签:

原文地址:http://www.cnblogs.com/xiaokanfengyu/p/4175091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!