【发布时间】:2013-06-13 11:44:13
【问题描述】:
我正在尝试从另一个UIViewController 调用一个方法,该方法接受一个字符串(url)作为参数并在UIWebView 中打开它。下面是UIViewController类中IBAction的代码:
-(IBAction)dashboardButtonTapped:(id)sender {
[self performSegueWithIdentifier:@"dashboard" sender:self];
Dashboard *db = [[self storyboard] instantiateViewControllerWithIdentifier:@"dashboard"];
[db openDashboard:@"http://www.google.com"];
}
接受 url 字符串的方法在另一个名为 DashBoard 的类中:
-(void)openDashboard:(NSString *) url {
[self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
}
我没有收到任何错误,但UIWebView 始终为空白。
可能是什么问题?
【问题讨论】:
-
您是否设置了
UIWebView委托?openDashboard:真的被调用了吗? -
我还没有为 UIWebview 设置代理。是的,它确实被调用了。
标签: objective-c uiwebview nsurlrequest