在didFinishLaunchingWithOptions
我的应用程序中,代码是
_homeViewController = [[HomeViewController alloc]init];
UINavigationController* _navigationController = [[UINavigationController alloc] initWithRootViewController:_homeViewController];
[self.window setRootViewController:_navigationController];
[_navigationController setNavigationBarHidden:YES];
[self.window makeKeyAndVisible];
在中HomeViewController
,我有两个按钮,如果按下按钮,我将展示 ViewController。如果 button1 被按下,代码是
if (_detailsViewController == nil)
_detailsViewController = [[DetailsViewController alloc]init];
[self.navigationController presentModalViewController:_detailsViewController animated:YES];
现在,当我在 detailsViewController 中并按下 iPhone Home 按钮时,在同一个类中,我正在使用UIApplicationDidEnterBackgroundNotification
并调用一个方法来执行以下行
[self.navigationController popToRootViewControllerAnimated:YES];
所以我想当我再次打开应用程序时,我可以看到 HomeViewController,但它不起作用。请帮我 !!