我在将字符串传递给作为网址的函数以通过 web 视图打开该特定方向时遇到问题。
-(IBAction)toWeb:(NSString*)web_direction {
UIViewController *webViewController = [[[UIViewController alloc] init] autorelease];
UIWebView *uiWebView = [[[UIWebView alloc] initWithFrame: CGRectMake(0,0,320,480)] autorelease];
[uiWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:web_direction]]];
[webViewController.view addSubview: uiWebView];
webViewController.title = @"web bar";
[self.navigationController pushViewController:webViewController animated:YES];
}
我想通过 MKannotation 调用该函数:
NSString *direction = @"http://www.google.com";
[btnDetails addTarget:self action:@selector(toWeb:direction) forControlEvents:UIControlEventTouchUpInside];
但是应用程序崩溃了。有什么想法吗?