2012-11-06 51 views
0

我有一个UIWebView嵌入作为子视图,从Web加载一个HTML表单。问题是,当您选择其中一个文本字段时,它会收到焦点,但键盘不显示。这只发生在iOS6上,如果我在iOS 4.3,5.1等上运行此应用程序,它按预期工作。任何一个有任何建议iOS的UIWebView不显示键盘当文本字段获得焦点

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
webView = [[UIWebView alloc] init]; 
[webView setUserInteractionEnabled:YES]; 
[webView setScalesPageToFit:YES]; 
[webView setKeyboardDisplayRequiresUserAction:YES]; 

// load url here 
NSURL *url = [NSURL URLWithString:redirectUrl]; 
//URL Requst Object 
NSMutableURLRequest *requestObj = [NSMutableURLRequest requestWithURL:url]; 
[requestObj setHTTPMethod:@"POST"]; 
[webView loadRequest:requestObj]; 
UIScrollView* sv = nil; 
for(UIView* v in [webView subviews]){ 
    if([v isKindOfClass:[UIScrollView class] ]){ 
     sv = (UIScrollView*) v; 
     sv.scrollEnabled = NO; 
     sv.bounces = NO; 

    } 
} 
[webView setOpaque:NO]; 
[webView setBackgroundColor:[UIColor whiteColor]]; 
webView.delegate = self; 
[self.view addSubview:webView]; 


} 

回答

1

你可以使用这个问题的答案:

Some UITextfields don't respond in iOs6

你以前 presentmodalviewcontroller在控制你在哪里调用与视图,以resingfirstresponder 问题。

但是,你也必须在所有预览控制器中resignfirst响应者,也就是说。

在我的情况下,我从一个搜索栏进入详细视图,并从详细信息分享到脸书。在facebook上分享的观点并没有显示键盘,这是因为我没有resiginif搜索栏的第一响应者。

希望它有帮助。

相关问题