我正在制作iPad应用程序,
我想一个接一个地在单个UIWebView上加载2个webPage,
第一个网页应该在我加载我的应用程序时出现,第二个网页应该点击tableView的单元格,
所以,在我的didLoad方法中,我正在写这个(第一个网页),
NSString *urlAddress = @”http://www.google.com”;
//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];
它工作得很好..
但是在同一个webview上同一页面上点击tableView的单元格我想加载另一个页面,(第二个网页)
我编写相同的代码,当我点击tableView图形的单元格没有显示时,
我是否需要清除网页或重新加载类似的网页?
提前帮助我,Thanx !!
答案 0 :(得分:0)
我从您的评论中看到您对第二个请求使用了错误的网址格式:
NSString *urlAddress1 = @”yahoo.com”; //Create a URL object.
NSURL *url1 = [NSURL URLWithString:urlAddress1]; //URL Requst Object
NSURLRequest *requestObj1 = [NSURLRequest requestWithURL:url1]; //Load the request in the
UIWebView. [webView loadRequest:requestObj1];
网址必须以
开头http://
否则它将无效。
答案 1 :(得分:0)
调用此方法,
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *urlAddress = @”http://www.google.com”;
//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];
}