ios开发问题,经验证,textview的contentsize.height不能准确判断高度

时间:2014-08-19 22:18:55   收藏:0   阅读:856

IOS7环境中,设置UITextView.text并不能立即更新contentSize,再用textView.contentSize.height无法获取当前内容的高度。采用以下方法可以解决这个问题。

1
2
3
4
5
6
7
8
9
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
         
        CGRect textFrame=[[self.textView layoutManager]usedRectForTextContainer:[self.textView textContainer]];
        height = textFrame.size.height;
         
    }else {
         
        height = self.textView.contentSize.height;
    }

ios开发问题,经验证,textview的contentsize.height不能准确判断高度,布布扣,bubuko.com

原文:http://www.cnblogs.com/zhangjl/p/3923090.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!