美文网首页
崩溃:"Auto Layout still required a

崩溃:"Auto Layout still required a

作者: 牛程程 | 来源:发表于2017-12-28 08:42 被阅读0次

当把一个自定义的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方法实现在最后,就可以解决这个问题。
}

相关文章

网友评论

      本文标题:崩溃:"Auto Layout still required a

      本文链接:https://www.haomeiwen.com/subject/qpkmgxtx.html