要做你所问的,看看UINavigationControllerDelegate协议,即
方法:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
当viewController参数不再是您的视图控制器时,您应该保存.
然而,在viewWillDisappear上这样做可能是一个更好(更简单)的想法.