问题
I have a UIWebView in UINavigationController. I have a TableView, When the clicks cell of the table, it goes to WebView, but when user clicks textfield in webview, keyboard will does not show up. Why does not show up? Which part of code is required?
This code is part of the transition to UIWebView below.
UIViewController *wvc = [[UIViewController alloc] init];
UIWebView *uiWebView = [[UIWebView alloc] initWithFrame: CGRectMake(0,0,320,480)];
[uiWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://sample/form.html"]]];
[wvc.view addSubview: uiWebView];
[self.navigationController pushViewController:wvc animated:YES];
Any help is greatly appreciated.
回答1:
This happens when the window containing the web view isn't the key window. This can happen if you create more than one UIWindow in your app and forget to return the key window status to your main window. Sending -makeKeyWindow or -makeKeyAndVisible to your main window (the one in your MainWindow nib or created by your app delegate) fixes this.
来源:https://stackoverflow.com/questions/9954003/keyboard-does-not-appear-in-the-uiwebview-on-the-uinavigationcontroller