iOS 5中的屏幕外UITextView不可见/明文 [英] Offscreen UITextView invisible/clear text in iOS 5

查看:108
本文介绍了iOS 5中的屏幕外UITextView不可见/明文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从笔尖加载的屏幕外UITextView实例,当用户点击评论按钮时,该笔实体移动到屏幕框架中。 enter使用的任何文本都是不可见的。如果用户旋转设备,则会显示文本。

I've got an off-screen UITextView instance loaded from a nib which is moved into the screen frame when the user taps a "comment" button. Any text the enter uses is invisible. If the user rotates the device, the text appears.

我尝试过抛出setNeedsDisplay和setNeedsLayout,以及设置text,textColor和font属性之后它出现在屏幕上,没有运气。

I've tried throwing setNeedsDisplay and setNeedsLayout, as well as setting the text, textColor, and font properties after it comes on screen with no luck.

我有一个示例Xcode项目,展示了bug。

I have an example Xcode project demonstrating the bug.

有什么建议吗?

推荐答案

我无法解决这个问题所以我等到视图在屏幕上完成动画并重新创建UITextView,删除旧的,然后用新的替换它。

I couldn't solve this problem so I wait until the view has finished animating on screen and recreate the UITextView, remove the old one, and replace it with the new one.

这是非常不优雅的我甚至需要保留一个BOOL ivar来记住我是否已经替换了文本视图(或不是)。

It's very inelegant since I even need to keep a BOOL ivar for remembering if I've already replaced the text view (or not).

这篇关于iOS 5中的屏幕外UITextView不可见/明文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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