I know that I have to call
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
//this dismiss keyboard on ios
- (BOOL) textViewShouldBeginEditing:(UITextView *)textView {
[self.comments resignFirstResponder];
return YES;
}
In order to dismiss keyboard on a form sheet, I also know that I have to call disablesAutomaticKeyboardDismissal
in the navigation controller if I have one.
Problem is: I create forms sheet with navigation controller programmatically like:
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
SettingsViewController *settingsVC = [sb instantiateViewControllerWithIdentifier:@"settingsViewController"];
//add navigation controller
UINavigationController *modalViewNavController= [[UINavigationController alloc] initWithRootViewController:settingsVC];
modalViewNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
modalViewNavController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:modalViewNavController animated:YES];
So I don't have a navigation controller class for form sheet, how can I dismiss keyboard in this case?
Do I have to create a navigation view controller?
UPDATE:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
End Up creating a navigation controller in the storyboard and call disablesAutomaticKeyboardDismissal
in the navigation controller's view controller, that solved the problem but I still wonder how to do this without creating a navigation controller class.
Any input is welcomed......