iphone - CustomTableCellView的实现-layoutSubviews需要调用super,NSInternalInconsistencyException

标签 iphone ios uitableview ios6

在 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:

临时修复:

如果我在自定义单元格中禁用 autoLayout,它工作正常。 但是在这种情况下方向处理并不好。请帮忙。

最佳答案

layoutSubviews needs to call super

可以在 iOS6 上通过将所有内容放在容器 View 中的自定义 tableview 单元格中来解决。即创建一个新 View 来填充单元格,然后在其中放置控件等。还要确保设置:

[theContainerView setTranslatesAutoresizingMaskIntoConstraints:NO]; 

对于容器和 subview

关于iphone - CustomTableCellView的实现-layoutSubviews需要调用super,NSInternalInconsistencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13627452/

相关文章:

iphone - 在 iOS 5 上使用 ARC 过早发布对象?

iphone - 如何在核心文本中呈现不同的段落样式?

ios - 移动时为多个帧设置动画的正确方法

ios - 在 UITableView 的单元格中方形 UImageView

ios - 触摸 UITableView 时取消手势识别器

ios - Xcode:将 TableView 添加到自定义单元格中

iphone - 将来自服务器的图像显示到 UIImageView

iphone - 如何更改ios分段控件一侧的大小?

ios - 尝试制作 App Store 加载栏

ios - 委托(delegate)语法