search

Home  >  Q&A  >  body text

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

高洛峰高洛峰2889 days ago1346

reply all(4)I'll reply

  • PHP中文网

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

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

    reply
    0
  • 迷茫

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

    Dynamicly calculate the string height when obtaining data, and set the parent control frame

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

    reply
    0
  • 迷茫

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

    It’s okay if the height of the parent view is not given. The content will prop it up
    Of course, if it is a cell, you need to calculate it yourself

    reply
    0
  • 阿神

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

    The bottom of the bottom view is equal to the bottom of the parent view

    reply
    0
  • Cancelreply