我怎样才能在点击提交时得到警报?

How can i get the alert in click of submit?

如何在点击提交时得到提醒?
我正在使用 WebView..

这是代码

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];

[webView setDelegate:self];

NSString *urlAddress = @“sssssss”;
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];

[self.view addSubview:webView];

提前致谢..

检查这个:

- (BOOL)webView: (UIWebView*)webView shouldStartLoadWithRequest: (NSURLRequest*)request navigationType: (UIWebViewNavigationType)navigationType {
      NSString *fragment, *scheme;
      if (navigationType == UIWebViewNavigationTypeLinkClicked) {
           //1
           [webView stopLoading];
           fragment = [[request URL] fragment];
           scheme = [[request URL] scheme];

           if ([scheme isEqualToString: @"file"] && [self respondsToSelector: NSSelectorFromString(fragment)]) {
               [self performSelector: NSSelectorFromString(fragment)];
               return NO;
           }

           [[UIApplication sharedApplication] openURL: [request URL]];
      }
      return YES;
}

您需要将委托设置为 WebView。

希望对您有所帮助。

1 - 将 IBAction 添加到您的提交按钮。

2 - 在被调用的方法中使用 UIAlertController 创建一个警报,该警报将在单击按钮时显示。