我从按钮 hulp 打开 PDF
这是代码:
-(IBAction)hulp;
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"Handleiding" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
webView.tag=55;
[[webView scrollView] setContentOffset:CGPointMake(0,500) animated:YES];
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"window.scrollTo(0.0, 50.0)"]];
[webView loadRequest:request];
[self.view addSubview:webView];
[webView release];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(aMethod:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Close" forState:UIControlStateNormal];
button.frame = CGRectMake(80, 425, 160, 40);
[button addTarget:self action:@selector(close:) forControlEvents:UIControlEventTouchUpInside];
[webView addSubview:button];
}
- (IBAction)close:(id)sender {
[[self.view viewWithTag:55] removeFromSuperview];
}
有谁看到我做错了什么:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LocationTestViewController aMethod:]: unrecognized selector sent to instance 0x8087c60'
*** First throw call stack:
(0x1f26012 0x15e8e7e 0x1fb14bd 0x1f15bbc 0x1f1594e 0x15fc705 0x38c920 0x38c8b8 0x44d671 0x44dbcf 0x44c872 0x3bc16d 0x3bc552 0x39a3aa 0x38bcf8 0x22badf9 0x22baad0 0x1e9bbf5 0x1e9b962 0x1eccbb6 0x1ecbf44 0x1ecbe1b 0x22b97e3 0x22b9668 0x38965c 0x244d 0x2385)
libc++abi.dylib: terminate called throwing an exception
(lldb)