开发者

iPad; TableView full of arbitrary number of text fields and buttons in different rows. resignFirstResponder on all textfields when button is pressed?

iPad:

I have a tableView full of an arbitrary number of text fields and buttons in different rows.

When you press a button I a modal popup will popup. If you press a button while editing a text field (and the keyboard is displayed on the iPad) something hilarious will happen. The popover will be开发者_如何转开发 75% off the corner of the screen (with a quarter visible in quarter.)

To avoid this bad behavior, how do you resignFirstResponder on all textfields in the table when the button is pressed?


You can implement this method:

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
     [textField resignFirstResponder];
     return YES;
}

As long as the textfields' delegate are your current view controller, it should work fine :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜