ResignFirstResponder does not work in a modular view controller

I am having a problem with the keyboard lagging in a view that is displayed using the UIModalPresentationFormSheet. It works great (hides the keyboard) when I use the UIModalPresentationPageSheet. Here is my very simple code that displays a modal view, one in the form sheet and one in the page sheet.

- (void)showModalWithFormSheet:(BOOL)formSheet { testViewController *test = [[testViewController alloc] initWithNibName:nil bundle:nil]; test.modalPresentationStyle = formSheet ? UIModalPresentationFormSheet : UIModalPresentationPageSheet; [self presentModalViewController:test animated:YES]; [test release]; } 

Here is the textField delegate who is resigning.

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

Identical code, but when presented as a sheet, I can’t get the keyboard to hide (after calling resignFirstResponder). I tried this on both the simulator and the device. Any help would be appreciated, it totally drives me crazy! It is hard to believe that this question was not raised before, did I miss something?

thanks

Ying

+4
source share
1 answer

Answered here . Just a few posts under yours.

+4
source

Source: https://habr.com/ru/post/1332277/


All Articles