Keyboard does not appear in the UIWebView on the UINavigationController

时光毁灭记忆、已成空白 提交于 2019-12-10 12:07:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!