I am a beginner in making iOS applications. I have made a simple webview showing my web page. The problem is that every link that is pressed in my web page opens in the webview. I want some links to open in safari. I would like links starting with "..something" to be opened inside the webview and every other link to be opened in safari. I also have a button for email and dial which i want to open in the dial app and email app on the phone. Is this a possibility? please explain simple.
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIWebView *webView;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize webView;
- (void)viewDidLoad
{
NSURL *url = [NSURL URLWithString:@"http://MyWebPage"];
NSURLRequest *requestURL = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestURL];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
I made the same application for android using java with this code below
@Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        try{
            System.out.println("url called:::" + url);
            if (url.startsWith("tel:")) {
                Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
                startActivity(intent);
            }  else if (url.startsWith("http:")
                    || url.startsWith("https:")) {
                 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); 
                 startActivity(intent);
            }  else if (url.startsWith("mailto:")) {
                MailTo mt=MailTo.parse(url);
                send_email(mt.getTo());
            }
            else {
                return false;
            }
        }catch(Exception e){
            e.printStackTrace();
        }
        return true;
    }
}
 
     
     
    