UITextView在旋转之前不显示文本 [英] UITextView not showing text until I rotate it

查看:133
本文介绍了UITextView在旋转之前不显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UISplitViewController,其视图具有UITextView作为主视图,但在我将ipad旋转两次之前,文本才会加载。

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.

应用程序启动时记录显示文本视图可用,并且其中的文本(在nib文件中定义)也正确加载。

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.

我在做什么错误?

推荐答案

好像我已经找到了在UIPopoverController中最初可以加载到UITextView中的字符数的限制(用于UISplitViewController中的纵向模式)。最大字符数为621.

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.

如果我在viewDidLoad中覆盖文本视图,我觉得很奇怪

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

self.textView.text = @"hello";

它会起作用,但是从nib加载文本却没有。通过一些试验和错误,似乎621是文本视图在初始加载时未显示的最大数字字符。

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.

使用UIWebView并加载内容代码修复此问题。

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

这篇关于UITextView在旋转之前不显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆