gpt4 book ai didi

当文本字段获得焦点时,iOS UIWebView 不显示键盘

转载 作者:行者123 更新时间:2023-11-29 04:19:04 24 4
gpt4 key购买 nike

我有一个嵌入为 subview 的 UIWebView,它从网络加载 html 表单。问题是,当您选择其中一个文本字段时,它会获得焦点,但键盘不会显示。这只发生在 iOS6 上,如果我在 iOS 4.3、5.1 等上运行此应用程序,它会按预期工作。大家有什么建议

- (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];


}

最佳答案

您可以使用此问题的答案:

Some UITextfields don't respond in iOs6

您必须在调用有问题的 View 的 Controller 中before Presentmodalviewcontroller 之前先resingfirstresponder。

但是,您还必须退出所有预览 Controller 中的第一响应者。

就我而言,我从搜索栏转到详细 View ,然后从详细 View 转到在 Facebook 上分享。 Facebook 中的分享 View 没有显示键盘,这是因为我不是搜索栏的第一响应者。

希望对您有所帮助。

关于当文本字段获得焦点时,iOS UIWebView 不显示键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13250355/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com