iPhone:调用textViewDidChange安全吗?
我正在查看 UIViewController
中的代码,它符合 UITextViewDelegate
协议,并且有一个名为 someTextView
的实例变量。
someTextView.text = @"some text";
[self textViewDidChange:someTextView];
这样安全吗?在我看来这不符合犹太洁食。是否有必要调用 textViewDidChange:
? someTextView.text = @"some text"
不会自动调用它吗?
我正在调试此错误 iPhone Objective-C:键盘不会'有时会用 resignFirstResponder 隐藏
I'm looking at code in a UIViewController
that conforms to the UITextViewDelegate
protocol and has an instance variable called someTextView
.
someTextView.text = @"some text";
[self textViewDidChange:someTextView];
Is that safe? That doesn't look Kosher to me. Is it even necessary to call textViewDidChange:
? Won't it get called automatically by someTextView.text = @"some text"
?
I'm debugging this error iPhone Objective-C: Keyboard won't hide with resignFirstResponder, sometimes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读
textViewDidChange:
手动调用 (UIView-) 委托方法是否安全且好主意取决于该方法内部的代码。有时这样做是有正当理由的。
但您的错误很可能不是由此代码片段引起的。
read the discussion of
textViewDidChange:
If it's safe and a good idea to call (UIView-) delegate methods manually depends on the code inside of the method. Sometimes there are valid reasons to do this.
But your bug is most likely not caused by this snippet.