码迷,mamicode.com
首页 > 移动开发 > 详细

用mansard对cell的子控件设置约束,并且自动计算cell高度的问题,ios7警告

时间:2016-06-02 11:04:42      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:

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

用mansard对cell的子控件设置约束,并且自动计算cell高度的问题,ios7警告

标签:

原文地址:http://www.cnblogs.com/daaiwusehng/p/5551943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!