如何在 UIWebView 前面添加 UIButton objective C

How to add UIButton in front on UIWebView objective C

我想在 UIWebview 上显示一个 UIButton。 但是 UIButton 显示在 webview 后面。

我试过下面的代码:

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    {
        if(navigationType==UIWebViewNavigationTypeLinkClicked && [[request.URL absoluteString] isEqualToString:myURL])
        {

            [_myBtn bringSubviewToFront:self.view];

            [self.myWebView addSubview:_myBtn];

 //i have tried this aswell

            //[_myBtn bringSubviewToFront:self.myWebView];

            //[self.view addSubview:_myBtn];

            return NO;
        }
        return YES;
    }

任何想法,我做错了什么? 谢谢

注释掉上面的代码,只需将 UIButton 移动到情节提要中的 UIWebView 下方,然后检查。