如何判断 UITextView 脏了?

发布于 2024-12-22 06:11:31 字数 177 浏览 6 评论 0原文

目前,我通过以下方式测试 UITextView 是否脏:

if ([self.textView.undoManager canUndo]) ...

这总是正确的吗?或者UITextView中有类似isDirty的方法吗?

Currently, I test whether a UITextView is dirty or not by:

if ([self.textView.undoManager canUndo]) ...

Is this always correct? Or is there any isDirty-like method in UITextView?

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

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

发布评论

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

评论(1

只是我以为 2024-12-29 06:11:31

您可以使用 UITextViewDelegate 收听很多内容,

请查看 UITextViewDelegate 文档 了解全面的详细信息

- (void)textViewDidBeginEditing:(UITextView *)textView

- (void)textViewDidEndEditing:(UITextView *)textView

- (void)textViewDidChange:(UITextView *)textView

还有更多关于 shouldBeginshouldEnd 编辑,以及选择更改。

希望能有所帮助。

You can listen to lots of things with the UITextViewDelegate

Check out the UITextViewDelegate documentation for comprehensive details

- (void)textViewDidBeginEditing:(UITextView *)textView

- (void)textViewDidEndEditing:(UITextView *)textView

- (void)textViewDidChange:(UITextView *)textView

There's more to do with shouldBegin and shouldEnd editing, and also selection changes.

Hope that helps out.

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