iPhone – 解雇RootViewController?

iPhone – 解雇RootViewController?,第1张

概述我有一个RegistrationViewController和一个LoginViewController: LoginViewController是我的InitialViewController / RootViewController. 如果我注册并单击Registrate-Button,它将自动推送到MainViewController.如果我按下Logout-Button,它会关闭到Regi 我有一个RegistrationVIEwController和一个LoginVIEwController:

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?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1001803.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存