基本上如标题所示,我在WebViewAppDelegate中遇到了一些问题
https://github.com/austin4195/Nucleus-iOS/blob/master/Classes/WebViewAppDelegate.m
第5-48行,但我认为问题在于定义将存储值的项目
谢谢!
答案 0 :(得分:0)
您的代码存在很多问题:
return
语句,因此永远不会调用您的代码。screenshotTaken
应在application:didFinishLaunchingWithOptions:
之外宣布。您应该使用self.webViewController.theWebView
代替webViewController.webView
。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
navigationController = [[UINavigationController alloc] init];
navigationController.navigationBar.hidden = YES;
navigationController.toolbar.barStyle = UIBarStyleBlack;
WebViewController *webViewController = [[WebViewController alloc] init];
webViewController.urlString = @"http://files.austinapps.org/File%20Site";
[navigationController pushViewController:webViewController animated:NO];
[webViewController release];
[self.window setRootViewController:navigationController];
[self.window makeKeyAndVisible];
self.webViewController = webViewController;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(screenshotTaken)
name:UIApplicationUserDidTakeScreenshotNotification
object:application];
return YES;
}
- (void)screenshotTaken{
[self.webViewController.theWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://website.com/"]]];
}