mansory設置cell子控件自上而下把cell的contentview撐開,就計算能夠自動計算高度了,可是ios7會報下面的警告ios
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ui
(this
"<MASLayoutConstraint:0x179e9210 UILabel:0x1673d3d0.height == 14.316>",spa
"<MASLayoutConstraint:0x1670dd90 UILabel:0x1673d3d0.top == UITableViewCellContentView:0x179d32e0.top>",3d
"<MASLayoutConstraint:0x1798e460 UIView:0x179df8e0.top == UILabel:0x1673d3d0.bottom + 10>",code
"<MASLayoutConstraint:0x179d57b0 UIView:0x179df8e0.bottom == UITableViewCellContentView:0x179d32e0.bottom - 25>",get
"<NSAutoresizingMaskLayoutConstraint:0x178c4980 UITableViewCellContentView:0x179d32e0.height == 44>"it
)io
最後後一句話是說原有的44默認約束和現有的有些衝突,解決辦法是table
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; if (self) { self.contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;//**這句話很重要 [self createSubViews]; } return self; }
http://stackoverflow.com/questions/19132908/auto-layout-constraints-issue-on-ios7-in-uitableviewcell