近日做ios的autolayout时候在兼容ios6的时候遇到以下Assert,但在ios7和ios8上就运行良好

Assertion failure in -[UITableViewCell layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2380.17/UIView.m:5776
required after executing -layoutSubviews. CategoryCell's implementation of -layoutSubviews needs to call super.

我的代码如下

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:UITableViewCellStyleValue1reuseIdentifier:@"default"];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        self.detailTextLabel.font = [UIFont systemFontOfSize:13];
        [self addBottomBorderWithHeight:0.5 color:APP_LINE_COLORleftOffset:15 rightOffset:15 andBottomOffset:0];  //assert发生在这一行,这行代码是在cell上添加一个autolayout的view
    }
    return self;
}


经过百度和google,网上给出的建议是禁用autolayout,我就郁闷了,难道因为吃饭会噎着就不吃饭了吗?

经过一下午的努力,终于解决了问题,将[self addBottomBorderWithHeight:...]改为[self.contentView addBottomBorderWithHeight:...],一切OK,跑的很顺畅

我想可能是在ios6上cell还不支持autolayout所导致的Assert。

大家有什么想法欢迎交流