扫码关注官方订阅号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
[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];
CGRect strRect = [str boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize: fontSize]} context:nil];
父视图高度不给就可以了 内容会把它撑起来当然如果是cell需要自己计算
最下面的视图的bottom等于父视图的bottom
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
获得数据时动态计算字符串高度, 设置父控件frame
相关方法:
CGRect strRect = [str boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize: fontSize]} context:nil];
父视图高度不给就可以了 内容会把它撑起来
当然如果是cell需要自己计算
最下面的视图的bottom等于父视图的bottom