详细方法如下:
在 iPhone 应用中打开网页时,如果用 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]]; 这种方法的话,会退出当前软件,启动 Safari。
下面是用 UIWebView 在当前程序中打开网页的代码
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];
本文介绍如何在iOS应用程序中使用UIWebView加载并显示网页内容,避免调用Safari等外部浏览器。
932

被折叠的 条评论
为什么被折叠?



