zoukankan      html  css  js  c++  java
  • ios开发问题,经验证,textview的contentsize.height不能准确判断高度

    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;
        }
  • 相关阅读:
    dom操作
    今天学到的知识点
    3.26随笔
    dom操作
    Ajax
    JSP、EL、JSTL
    Cookie和Session
    HttpServletResponse
    Servlet
    tomcat
  • 原文地址:https://www.cnblogs.com/zhangjl/p/3923090.html
Copyright © 2011-2022 走看看