Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
get-textView contentsize高度在iOS 8中错误_Ios_Textview_Autolayout_Ios8_Contentsize - Fatal编程技术网

get-textView contentsize高度在iOS 8中错误

get-textView contentsize高度在iOS 8中错误,ios,textview,autolayout,ios8,contentsize,Ios,Textview,Autolayout,Ios8,Contentsize,使用设置textView的约束,在[textView layoutIfNeed]之后获取textView.contentSize.height,此值为-8 此错误仅在低于9.0的systemVersion中存在 找到一种方法并尝试: [[textView layoutManager] usedRectForTextContainer:textView.textContainer] gettextView.contentSize.height也不正确请在将文本分配给textView后尝试此操作

使用设置textView的约束,在
[textView layoutIfNeed]
之后获取
textView.contentSize.height
,此值为-8

此错误仅在低于9.0的systemVersion中存在

找到一种方法并尝试:

[[textView layoutManager] usedRectForTextContainer:textView.textContainer]

get
textView.contentSize.height
也不正确

请在将文本分配给textView后尝试此操作

txtview.sizeToFit()