LoginVIEwController是我的InitialVIEwController / RootVIEwController.
如果我注册并单击Registrate-button,它将自动推送到MainVIEwController.如果我按下logout-button,它会关闭到RegistrationVIEwController,这是因为我使用[self dismissModalVIEwController animated:YES].
- (IBAction)logoutpressed:(ID)sender { [self dismissModalVIEwControllerAnimated:YES]; }
如果我按下logout-button,我如何解除对LoginVIEwController的关注.
解决方法 您可以使用UINavigationController方法-popToRootVIEwControllerAnimated:.- (IBAction)logoutpressed:(ID)sender { [self.navigationController popToRootVIEwControllerAnimated:YES];}
如果您正在谈论一个在另一个上面呈现的几个模态视图,您可以通过将-dismissVIEwControllerAnimated:completion:或者old -dismissModalVIEwControllerAnimated:发送到堆栈中的最低层来解除所有这些视图,如文档中所述:
总结If you present several vIEw controllers in succession,thus building a stack of presented vIEw controllers,calling this method on a vIEw controller lower in the stack dismisses its immediate child vIEw controller and all vIEw controllers above that child on the stack. When this happens,only the top-most vIEw is dismissed in an animated fashion
以上是内存溢出为你收集整理的iPhone – 解雇RootViewController?全部内容,希望文章能够帮你解决iPhone – 解雇RootViewController?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)