-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
10.3 系统,Label高度自适应不行了 #291
Comments
确实,求作者解决 |
啊,希望作者能看到啊,10.3的确是无法高度自适应了 |
已经有解决方法, 在cell里进行布局之前先对contentView进行约束就可以了,我的是这样解决的 |
有约束冲突,需要设置preferredMaxLayoutWidth |
如果xib布局中设置cell的高度为350,如果[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self); }];这样解决的话,在iPhone6中会报UITableViewCellContentView .width = 375 |
@lovemo 设置contentView的约束,label显示没问题,但是其他约束出现了问题 |
直接在 awakeFromNib 那里 把 preferredMaxLayoutWidth 写进去不可以吗? |
|
if (IOS_VERSION > 10.2) {
} |
@ChenYanTao666 preferredMaxLayoutWidth这个你是怎么设置呢?设置成0? |
这么好的库,希望作者能持续更新 |
@ChenYanTao666 添加了 只有正确设置文本内容的宽度preferredMaxLayoutWidth值,才显示正常 |
相同的问题 |
4 similar comments
相同的问题 |
相同的问题 |
相同的问题 |
相同的问题 |
相同的问题,10.3之后确实失败了 |
@zigang 不用设置这个,就按照我写的加个在计算高度的方法里面加个约束就行了 |
对于UILabel多行在10.3及以上版本失效,设置preferredMaxLayoutWidth虽然能达到效果,但是有点坑呀,如果一行只有一个UILabel还好点,对于有多个控件除非固定死了宽度,不然就动态算确实很麻烦呀。 |
我试了一下,将templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO;这个改为YES在10.3就没问题了,不过感觉不太靠谱 |
上面的方法对没有使用NSMutableAttributedString管用,相反则出问题 |
对于有2个或以上的多行label时 , 设置这个preferredMaxLayoutWidth 加上[cell.contentView mas_makeConstraints:^(MASConstraintMaker *make) { |
@Zysss 我也这样加了,就正常了。但还是不知道原因。。。 去看了下作者的微博,他好像离开百度了,不知道现在还维不维护了。 也不知道他的邮箱账号多少,不然就可以直接发邮件问 |
相同的问题,还是希望作者修改下库 |
Will fix in next release |
我在cell的布局代码中增加了
问题得到了解决 |
@iStarEternal 我添这个代码报错 |
closed by 9b18d46 |
@ChenYanTao666 |
设置preferredMaxLayoutWidth 可以解决,但是如果是使用自动布局,一般我们不知道Label的宽度
The text was updated successfully, but these errors were encountered: