实际上有两种方法,第一种是:
1 |
这种方法将会退出当前程序,用Safari打开url。我有好几个朋友都问到这个问题,实际上非常简单,可以使用UIWebView在当前程序中打开网页(假定你的UIWebView实例为webView):
1 2 3 4 5 6 7 8 9 10 | NSString *urlAddress = @"http://localhost"; //Create a URL object. NSURL *url = [NSURL URLWithString:urlAddress]; //URL Requst Object NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //Load the request in the UIWebView. [webView loadRequest:requestObj]; |



