[英]UITextView delegate not getting all method calls
I have a UIViewController that implements UITextViewDelegate and is connected as the delegate to my UITextView. 我有一个实现UITextViewDelegate的UIViewController,并作为代理连接到我的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: 但是,当我按下键盘上的Return键时,我没有接到以下电话:
- (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! 提前致谢!
Better to use keyboard notifications instead of using delagates. 最好使用键盘通知,而不要使用延迟通知。 Register your viewController as observer for that notification.
将您的viewController注册为该通知的观察者。 I am pretty sure that it sounds good.
我很确定这听起来不错。
是的,不同的代表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.