【发布时间】:2016-06-24 08:29:45
【问题描述】:
我已将 MMDrawerController 库集成到 iOS 应用程序中,现在我需要恢复应用程序状态,即使应用程序在后台被终止(仅当应用程序进入时)从前台到后台),它在普通导航应用程序中工作正常,但是当我在我的应用程序中使用“setCenterViewController”选项更改导航时,恢复没有按预期工作,我已按照本文中提供的所有说明进行操作链接:“https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html”
我使用 setCenterViewController 选项(从 MMDrawer 推荐)导航到特定屏幕,然后在后台删除应用程序,当我们重新打开它时,它会以默认初始屏幕启动,但我们希望它应该重新打开进入后台前的画面。
这里是代码sn-p:
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
appDelegate.homeController.navigationController.navigationBarHidden = YES;
HomeViewController *homeVC = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
UINavigationController *_navg = [[UINavigationController alloc]initWithRootViewController:homeVC];
_navg.restorationIdentifier = @"homeNavigationController";
homeVC.title = [self.dataSource objectAtIndex:indexPath.row]; homeVC.restorationIdentifier = @"HomeViewController";
[appDelegate.drawerController setCenterViewController:_navg withCloseAnimation:YES completion:nil];
self.currentViewController = _navg;
self.currentViewController.restorationIdentifier = @"homeNavigationController";
帮我解决这个问题。
【问题讨论】:
-
not working as expected- 那么发生了什么?你添加了什么代码?你做了什么调试?你观察到了什么? -
我使用 setCenterViewController 选项(从 MMDrawer 推荐)导航到特定屏幕,然后在后台删除应用程序,当我们重新打开它时,它会以默认初始屏幕启动,但我们希望它应该用 Screen it 重新打开在进入后台之前有。
-
恢复状态是什么意思?这是关于登录用户吗?
-
不,根据我的要求,我必须恢复一些详细信息屏幕。
-
保存状态并在应用重启时进行模拟不是一个选项?
标签: ios objective-c state-restoration mmdrawercontroller