UITextView not showing text until I rotate it

匆匆过客 提交于 2019-12-25 01:43:43

问题


I'm using a UISplitViewController, with a view that has a UITextView as the master view, but the text does not load until I rotate the ipad twice.

Logging when the app starts shows that the text view is available and the text inside it (which is defined in the nib file) is also loaded properly.

What am I doing wrong?


回答1:


It seems like I've found the limit to how many characters can be initially loaded into UITextView in a UIPopoverController (for portrait mode in UISplitViewController). The maximum number of characters is 621.

I thought it weird that if I override the text view in viewDidLoad with

self.textView.text = @"hello";

it would work, but loading the text from the nib as is didn't. Through some trial and error, it seems like 621 is the maximum number characters before the text view doesn't show upon initial load.

Using a UIWebView and loading the content in code fixes this.



来源:https://stackoverflow.com/questions/4617618/uitextview-not-showing-text-until-i-rotate-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!