2012-11-06 53 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搜索欄的第一響應者。

希望它有幫助。

相關問題