在 tableView xib 的自定义单元格中使用 autoLayout 时,我收到以下错误。
在 iOS 6 模拟器中运行时CustomCells的-layoutSubviews的实现需要调用super
Assertion failure in
-[CustomCells layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. CustomCells's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
在 iOS 5 模拟器中运行时
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The NIB data is invalid.'
*** First throw call stack:
临时修复:
如果我在自定义单元格中禁用自动布局,它工作正常。
但在这种情况下,方向处理并不好。请帮忙。
layoutSubviews needs to call super
可以通过将自定义表格视图单元格中的所有内容放入容器视图中来解决 iOS6 上的问题。即创建一个新视图来填充单元格,然后在其中放置控件等。还要确保您设置:
[theContainerView setTranslatesAutoresizingMaskIntoConstraints:NO];
对于容器和子视图
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)