• 用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
  • 相关阅读:
    目录路径加反斜杠和不加的区别
    window端口号被占用解决
    个人博客设计记录
    2017/12/15
    添加code到github上
    跨域简介
    客户端存储
    window.name跨域
    BZOJ1305: [CQOI2009]dance跳舞
    BZOJ4872: [Shoi2017]分手是祝愿
  • 原文地址:https://www.cnblogs.com/daaiwusehng/p/5551943.html
Copyright © 2020-2023  润新知