我的应用程序中有一个 UIViewController,其中包含问题、mcqs 答案及其相关分数。
我将这个控制器推到其他控制器中,即
QuestionViewController *questionController = [delegate getQuestionScreen];
// If Iphone/iPod Touch
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
// If iPhone 5 or new iPod Touch
if([UIScreen mainScreen].bounds.size.height == 568){
questionController = [[QuestionViewController alloc] initWithNibName:@"QuestionViewController" bundle:nil];
} else{
// Regular iPhone
questionController = [[QuestionViewController alloc] initWithNibName:@"QuestionViewController_iPhone4" bundle:nil];
}
}
questionController.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;
[self.navigationController pushViewController:questionController animated:NO];
当我在这个控制器上时,我打开侧面菜单(如 facebook)和新控制器的选择选项,比如 HelpController...
DemoViewController *demoController = [[DemoViewController alloc] initWithNibName:@"HelpViewController_iPhone4" bundle:nil];
UINavigationController *navigationController = self.menuContainerViewController.centerViewController;
NSArray *controllers = [NSArray arrayWithObject:demoController];
navigationController.viewControllers = controllers;
[self.menuContainerViewController setMenuState:MFSideMenuStateClosed];
当我回到 QuestionViewController 的前一个屏幕时,我必须创建该控制器的新对象,结果我丢失了所有计算和旧数据,因为它加载了新数据。
如何存储旧控制器以再次导航或在该特定状态下重新使用。
如果有什么不清楚的问题,问我.......