我在导航控制器中嵌入了uiwebview。我希望能够通过简单地点击一个uibarbuttonitem来改变uiwebview。有谁知道怎么做?
这是我现在拥有的方法。
-(void)action {
if (item.link) {
self.linkString = item.link;
}
NSString *urlAddress = @"%@/#comments", linkString;
NSURL *address = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:address];
[contentLabel loadRequest:requestObj];
}
答案 0 :(得分:0)
您可以设置目标选择器或IBAction来更改请求对象:
-(IBAction) action {
NSString *urlAddress = @"http://google.com";
NSURL *address = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:address];
[theWebView loadRequest:requestObj];
}
或
-(void) action {
NSString *urlAddress = @"http://google.com";
NSURL *address = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:address];
[theWebView loadRequest:requestObj];
}