UITextView 委托未获取所有方法调用
我有一个 UIViewController 实现 UITextViewDelegate 并作为委托连接到我的 UITextView。每当点击文本视图时,我都会接到电话:
- (void)textFieldDidBeginEditing:(UITextField *)sender
每当视图的内容发生变化(键盘、编程修改)时,我都会接到电话:
- (void)textViewDidChange:(UITextView *)textView
但是当我按键盘上的 Return 键时,我没有接到电话to:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
这个方法有什么不同吗?是否需要在某个地方设置一些特殊的东西来确保我接到这个电话?
提前致谢!
I have a UIViewController that implements UITextViewDelegate and is connected as the delegate to my UITextView. Whenever the text view is tapped, I get a call to:
- (void)textFieldDidBeginEditing:(UITextField *)sender
and whenever the contents of the view change (keyboard, programmatic modification), I get calls to:
- (void)textViewDidChange:(UITextView *)textView
But when I hit the Return key on the keyboard, I am not getting a call to:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
Is there something different about this method? Is there something special that needs to be set somewhere to make sure I get this call?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好使用键盘通知而不是使用延迟。将您的 viewController 注册为该通知的观察者。我很确定这听起来不错。
Better to use keyboard notifications instead of using delagates. Register your viewController as observer for that notification. I am pretty sure that it sounds good.
是的,不同的代表。
Yep, different delegate.