开发者

textFieldShouldEndEditing not firing unless keyboard done key used to go to next uitextfield

开发者 https://www.devze.com 2023-01-26 02:20 出处:网络
so i have a problem where i have two uitextfields.i have delegate in header file. i find that if a user uses their finger to go from the field 1 directly to field 2 that textFieldShouldEndEditing doe

so i have a problem where i have two uitextfields. i have delegate in header file.

i find that if a user uses their finger to go from the field 1 directly to field 2 that textFieldShouldEndEditing doesn't fire. it immediately goes to the 开发者_运维知识库2nd field's textFieldShouldBeginEditing. can anyone tell me how to catch exiting field 1 if you dont use the keyboard?

thanks!


Do the same as what you would do in textFieldShouldEndEditing:

Check what text field is currently the first responder.

Check if the user is allowed to leave the current text field or not.

If not then return NO from textFieldShouldBeginEditing.

0

精彩评论

暂无评论...
验证码 换一张
取 消