如何从appDelegate推UIViewController
问题描述:
我有一个UIViewController
(说A)。点击UIViewController
(A)中的一个按钮,我加载一个UIWebView
。点击UIWebView
中的组件后,我需要再次推UIViewController
(A)。但我正在处理appdelegate类中webview中的click事件。我将如何推出appdelegate类中的UIViewController
。如何从appDelegate推UIViewController
组件在UIWebView
的点击是由
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
}
中的appdelegate处理
答
只要你有你的主窗口和具有NavigationController屏幕上的一个参考,这应该做的罚款:(需要iOS 4)
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
[navigationController pushViewController:newViewController animated:YES];
self.window.rootViewController没有pushViewController方法 – 2012-04-20 13:52:47
问题是我是n不能从应用程序委托中推送视图控制器 – 2012-04-20 13:59:50
检查我的编辑... – 2012-04-20 14:49:22