Reputation: 3677
In the UITableViewController is using custom cells. In the custom cell there is a TextField. Need to dismiss the the keyboard when the user touches outside of the keyboard. In the custom cell's .m file have added this code;
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[holeScoreTextField resignFirstResponder];
}
This does work for when the user touches another cell or inside the same cell. Issue is that in the UITableViewController is a view with some information. The above code does not work for that view.
Upvotes: 1
Views: 406
Reputation: 597
A very quick, dirty, and simple solution is to simply create a full screen sized invisible button over the entire screen. The keyboard will always appear over the top of that view.
Hide the view on viewWillAppear:
and textFieldShouldEndEditing:
, and show it on textFieldShouldBeginEditing:
.
Should work like a charm.
Upvotes: 1