How to open a view with a keyboard appearing when the view is already loaded?

I have a requirement when I have a text field in a view. When I want to open a view by switching the tab (TabBased Application), the keyboard appears the first time the view is loaded, because the loadview method is called. But when I switch to tab2 and switch back to tab1 again, the load view is not called. I want the keyboard to appear every time I open the tab1 page.

+5
source share
1 answer

Use a -viewWillAppear:message in your view controller to send a text field -becomeFirstResponder, for example:

- (void) viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [myTextField becomeFirstResponder];
}
+10
source

All Articles