开发者

IPad Dismiss Keyboard event handling

开发者 https://www.devze.com 2023-03-18 05:12 出处:网络
Pressing the dismiss keyboard button (in the lower right开发者_如何转开发 of the keyboard) is not calling method:

Pressing the dismiss keyboard button (in the lower right开发者_如何转开发 of the keyboard) is not calling method:

- (BOOL)textFieldShouldReturn:(UITextField *)textField

How can I handle this event and how do I differentiate it from other events (if it's handled by an aggregate event handler)?


Are you setting the delegate for the textfield? Fix in Interface Builder, or in code; e.g.:

self.TEXTFIELDNAME.delegate = self;

See this post too, should help.


You can listen for keyboard hide UIKeyboardWillHideNotification notification.

Example code is here http://developer.apple.com/iphone/library/samplecode/KeyboardAccessory/Listings/Classes_ViewController_m.html

Or even you can implement method

-(void)textFieldDidEndEditing:(UITextField *)textField
0

精彩评论

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

关注公众号