UITextView not showing text until I rotate it

2019-09-08 07:26发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-08 08:11

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.

查看更多
登录 后发表回答