简体   繁体   English

多个委托要求UITextField

[英]Multiple delegate called for UITextField

I have textfield along with other controllers on one of my page, but i notice while testing two delegates as mentioned below get called.. one by one and does not allow me to enter text. 我在一个页面上有textfield以及其他控制器,但是我注意到在测试如下所述的两个委托时,会被调用..一个接一个,并且不允许我输入文本。 if i enter 1st character both delegates gets called simultaneously and keyboard comes down. 如果我输入第一个字符,则两个代表将同时被呼叫,并且键盘会下降。

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField

i tried to search for answer but i am not getting why this is happening... 我试图寻找答案,但我不明白为什么会这样...

You might be resigning textfield as first responder in your 您可能正在将文本字段辞职为您的第一响应者

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

Method. 方法。 Please check your code and remove 请检查您的代码并删除

[textField resignFirstResponder];

from code. 从代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM