在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