我可以通过从实例化它的父 View Controller 调用 [self.navigationController popViewControllerAnimated:YES];
从 UINavigationController
的堆栈中弹出一个 View Controller ,或来自 subview Controller 本身。哪种方式更可取?
最佳答案
我想答案是“最有意义的”;如您所说,您可以从父级、子级或什至其他持有对导航 Controller 的引用的类中调用 popViewControllerAnimated:
。
对于大多数应用程序, subview 将包含一个“后退”或“完成”按钮或一些其他导致它被弹出的操作。通常,我会说这是更可取的行为: subview Controller 弹出自身。
否则, child 将不得不(通过委托(delegate)或其他方式)调用 parent 说“砰!”然后会调用 popViewControllerAnimated:
。对于如此简单的操作,这感觉有点太复杂了。
关于iphone - 应该从父 ViewController 还是子 ViewController 调用 popViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10021519/