84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
在UIscrollview里面增加uilable,uilabel的高度是动态变化的,所以UIscrollview的contentsize的高度也是自动变化的。现在问题是我搜到的所有办法都无法获取到uilabel的实际高度。有什么解决办法吗
认证高级PHP讲师
Since your UILabel changes dynamically, what does it change based on? Does it change based on the amount of content? Follow along and find
You can try the idea of highly dynamic change of Cell (automatic layout). Wouldn't it be better if it is calculated by code and added directly?
Use AutoLayout, label edge and width and scrollView as constraints.
[label mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(scrollView); make.width.equalTo(scrollView); }];
This is how Masonry writes it
Since your UILabel changes dynamically, what does it change based on? Does it change based on the amount of content? Follow along and find
You can try the idea of highly dynamic change of Cell (automatic layout). Wouldn't it be better if it is calculated by code and added directly?
Use AutoLayout, label edge and width and scrollView as constraints.
This is how Masonry writes it