ios - UIscrollview 和 UIlable 高度问题
PHP中文网
PHP中文网 2017-04-17 17:57:38
0
3
579

在UIscrollview里面增加uilable,uilabel的高度是动态变化的,所以UIscrollview的contentsize的高度也是自动变化的。现在问题是我搜到的所有办法都无法获取到uilabel的实际高度。有什么解决办法吗

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
迷茫

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!