2

enter image description here

How can i get the alert in click of submit ?
i am using WebView..

Here is the code

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

Thanks in Advance..

A1rPun
  • 16,287
  • 7
  • 57
  • 90
Sudheer Kolasani
  • 283
  • 5
  • 28

2 Answers2

3

Check this:

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

You need to set delegate to WebView.

Hope this helps.

Meet Doshi
  • 4,241
  • 10
  • 40
  • 81
Satish A
  • 584
  • 4
  • 17
-3

1 - Add a IBAction to your submit button.

2 - Inside the method that gets called use UIAlertController to create a alert that will be displayed when the button is clicked.

Tejas K
  • 682
  • 11
  • 28