如何让UITextView的文字真正消失?

发布于 2024-08-19 16:45:01 字数 257 浏览 4 评论 0原文

我的程序有一个UITextView,我手动输入并滚动文本:

[myTextView scrollRangeToVisible:NSMakeRange([myTextView.text length]-1, 1)];

输入一定量后文本将消失(如果文本长度> 200) 但是,当我通过 NSLog 输出内容时,文本内容仍然有效,并且每次输入文本时都会更新;它只是不会显示在 myTextView 上

有什么建议吗?

My program has a UITextView and I enter and scroll the text manually:

[myTextView scrollRangeToVisible:NSMakeRange([myTextView.text length]-1, 1)];

The text will disappear after a certain amount of input (if text length > 200)
However, when I output the content via NSLog, the text content is still valid and being updated every time I enter the text; it just won't show on myTextView

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苏佲洛 2024-08-26 16:45:01

同样的问题在这里:

我有一个 UIView,我在触摸事件之后在屏幕上进出动画。

该视图有一个 UILabel、一个 UIButton 和一个 UITextView。
不知何故,如果我对它们进行 NSLog,那么 TextViews alpha、text 和 textColor 属性都可以。

编辑:在我尝试在 UITextView 上滚动后,显然文本会重新出现;

Same problem here:

I have a UIView that I animate in and out of the screen following Touch Events.

This View has a UILabel, a UIButton and a UITextView.
Somehow the TextViews alpha, text and textColor attributes are all Ok, if I NSLog them.

EDIT: Appearently the text reappears after I try to scroll at the UITextView;

深海不蓝 2024-08-26 16:45:01

呃,我不是 i-developer,但是你不能在 UIView 实际上变得不可见之后将 Text 设置为 null 或空字符串吗?我确信该平台允许您在动画中注册“完成回调”,该回调将在动画完成其周期时运行。

Uh, I'm not i-developer, but can't you just set the Text to null or empty-string just after the UIView is actually made invisible? I'm sure that the platform allows you to register a "finished-callback" in the animation, that will run when the animation completes its cycle..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文