Html 无法在IOS 9的UIWebView中选择下拉列表

Html 无法在IOS 9的UIWebView中选择下拉列表,html,ios,objective-c,uiwebview,xib,Html,Ios,Objective C,Uiwebview,Xib,我正在UIWebView中显示一个有下拉菜单的网站页面。用户可以从下拉列表中选择值,但当应用程序关闭并再次打开时,此下拉列表停止工作,意味着用户无法选择它 奇怪的是,如果我们在那个dropdwon上单击一下javascript的警报框,然后点击警报框的ok按钮(意味着dropdwon可以点击),一切都会正常工作,那么原因和解决方案是什么呢 我也有同样的问题,所以我找到了解决办法 在您的网站中,在document.ready中放置以下javascript行,其中有下拉列表 var appname

我正在UIWebView中显示一个有下拉菜单的网站页面。用户可以从下拉列表中选择值,但当应用程序关闭并再次打开时,此下拉列表停止工作,意味着用户无法选择它


奇怪的是,如果我们在那个dropdwon上单击一下javascript的警报框,然后点击警报框的ok按钮(意味着dropdwon可以点击),一切都会正常工作,那么原因和解决方案是什么呢

我也有同样的问题,所以我找到了解决办法 在您的网站中,在document.ready中放置以下javascript行,其中有下拉列表

 var appname = 'yourappName';
        var actionName = 'displayAlert';
        var url = appname + '://' + actionName;
        document.location.href = url;
在具有UIWebView的控制器中放置以下代码

  - (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
 navigationType:(UIWebViewNavigationType)navigationType {

    // these need to match the values defined in your JavaScript
    NSString *myAppScheme = @"wfsapp";
    NSString *myActionType = @"displayAlert";

    // ignore legit webview requests so they load normally
    if (![request.URL.scheme isEqualToString:myAppScheme]) {
        return YES;
    }

    // get the action from the path
    NSString *actionType = request.URL.host;


    // look at the actionType and do whatever you want here
    if ([actionType isEqualToString:myActionType]) {
    /*    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Loading"
                                                        message:@"Initialising Search Filters..."
                                                       delegate:self
                                              cancelButtonTitle:NULL
                                              otherButtonTitles:nil];*/



        //[alert show];
    /*   UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@""
                                                                       message:NULL
                                                                preferredStyle:UIAlertControllerStyleActionSheet];
        alertController.view.hidden = YES;

        alertController.modalPresentationStyle  = UIModalPresentationCurrentContext;
        alertController.view.backgroundColor  = [UIColor clearColor];*/
        UIViewController *alertController = [UIViewController alloc];
        alertController.view.hidden  = YES;
        alertController.view.backgroundColor = [UIColor clearColor];

        self.view.backgroundColor = [UIColor clearColor];
        self.modalPresentationStyle = UIModalPresentationCurrentContext;

        [self presentViewController:alertController animated:NO completion:^ {




        }];
        [alertController dismissViewControllerAnimated:NO completion:nil];

    }
当页面加载并执行javascript行时,上面的代码不会释放任何viewcontroller,但会触发dropddown再次工作