I have a UITextField in a Landscape view, and when I press the \'dismiss keyboard\' button in the lower right of the UIKeyboard view, the keyboard does NOT disappear. Is the
To dismiss the keyboard using the dismiss keyboard button you need to implement the delegate method
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
//Check if your text field is first responder, and if it is, have it resign
}
Alternatively, if you want to dismiss the keyboard by tapping outside of it, use
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UIView* view in self.view.subviews)
{
if ([view isKindOfClass:[UITextField class]]) {
[view resignFirstResponder];
}
if ([view isKindOfClass:[UITextView class]]) {
[view resignFirstResponder];
}
}
}