当把一个自定义的view,加到viewcontroller的view中显示时,有时出现崩溃现象。
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. XXXview'simplementation of -layoutSubviews needs to call super.'
解决办法:
-(void)layoutSubviews
{
//控件的frame变化逻辑
...
[super layoutSubviews]; //把父类的layoutSubviews方法实现在最后,就可以解决这个问题。
}