[Objective-C] How to open URL ?

NSURL *url = [NSURL URLWithString:@"http://piggy-mylifemystyle.blogspot.com/"];

●使用WebView
    UIWebView *web=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [web loadRequest:requestObj];
    [self.view addSubview:web];

●不使用WebView,直接開啟手機Safari
    [[UIApplication sharedApplication] openURL:url];

沒有留言: