suchen

Heim  >  Fragen und Antworten  >  Hauptteil

ios开发app - iOS开发使用Masonry布局如何让父视图的高度随着子视图的变化而变化?

高洛峰高洛峰2889 Tage vor1351

Antworte allen(4)Ich werde antworten

  • PHP中文网

    PHP中文网2017-04-18 09:23:28

        [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(@0);
             make.bottom.equalTo(@0);
         }];
    

    Antwort
    0
  • 迷茫

    迷茫2017-04-18 09:23:28

    获得数据时动态计算字符串高度, 设置父控件frame

    相关方法: CGRect strRect = [str boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize: fontSize]} context:nil];

    Antwort
    0
  • 迷茫

    迷茫2017-04-18 09:23:28

    父视图高度不给就可以了 内容会把它撑起来
    当然如果是cell需要自己计算

    Antwort
    0
  • 阿神

    阿神2017-04-18 09:23:28

    最下面的视图的bottom等于父视图的bottom

    Antwort
    0
  • StornierenAntwort