CustomTableCellView的-layoutSubviews实现需要调用super,NSInternalInconsistencyException [英] CustomTableCellView's implementation of -layoutSubviews needs to call super , NSInternalInconsistencyException

查看:124
本文介绍了CustomTableCellView的-layoutSubviews实现需要调用super,NSInternalInconsistencyException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在tableView xib的自定义单元格中使用autoLayout时,我收到以下错误。

On using autoLayout in custom cell for tableView xib, i am getting following error.

在iOS 6模拟器中运行
CustomCells的-layoutSubviews实现需要调用super

When running in iOS 6 simulator CustomCells's implementation of -layoutSubviews needs to call 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,则工作正常。
但在这种情况下,定向处理并不好。请帮助。

It is working fine if am disabling the autoLayout in custom cell. But orientation handling is not fine in this case. Please help.

推荐答案

layoutSubviews needs to call super

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

Can be worked around on iOS6 by putting everything in your custom tableview cell in a container view. ie Create a new view to fill the cell then place controls etc inside that. Also make sure you set:

[theContainerView setTranslatesAutoresizingMaskIntoConstraints:NO]; 

容器和子视图的

for the container and subviews

这篇关于CustomTableCellView的-layoutSubviews实现需要调用super,NSInternalInconsistencyException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆