ios开发app - iOS开发使用Masonry布局如何让父视图的高度随着子视图的变化而变化?
高洛峰
高洛峰 2017-04-18 09:21:28
0
4
1238
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

Antworte allen(4)
洪涛
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(@0);
         make.bottom.equalTo(@0);
     }];
迷茫

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

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

迷茫

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

阿神

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

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!