用mansard對cell的子控件設置約束,並且自動計算cell高度的問題,ios7警告


mansory設置cell子控件自上而下把cell的contentview撐開,就計算可以自動計算高度了,但是ios7會報下面的警告

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) 

(

    "<MASLayoutConstraint:0x179e9210 UILabel:0x1673d3d0.height == 14.316>",

    "<MASLayoutConstraint:0x1670dd90 UILabel:0x1673d3d0.top == UITableViewCellContentView:0x179d32e0.top>",

    "<MASLayoutConstraint:0x1798e460 UIView:0x179df8e0.top == UILabel:0x1673d3d0.bottom + 10>",

    "<MASLayoutConstraint:0x179d57b0 UIView:0x179df8e0.bottom == UITableViewCellContentView:0x179d32e0.bottom - 25>",

    "<NSAutoresizingMaskLayoutConstraint:0x178c4980 UITableViewCellContentView:0x179d32e0.height == 44>"

)

最后后一句話是說原有的44默認約束和現有的有些沖突,解決辦法是

- (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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM