ios 7 Autolayout bug

ios 7 Autolayout bug

错误类型:NSInternalInconsistencyException(SIGABRT)
详情:Auto Layout still required after executing -layoutSubviews. MttFeedsVideoActionBar's implementation of -layoutSubviews needs to call super.

根据提示,在使用autolayout的场景下,actionbar的layoutsubview()方法里,需要在[super layoutsubviews()] 调用之前,先调用autolayout的约束方法,所以就这么处理:

- (void)layoutSubviews
{
    if([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
        [super layoutSubviews];
    }
    //code needs to be excuted
    [self setLayout];
    if([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
        [super layoutSubviews];
    }
}
posted @ 2017-07-26 13:26  伟大的臭猪猪  阅读(272)  评论(0编辑  收藏  举报