I use the UINavigationController to control the navigation of the controllers
In the normal case
RegistrationView β LoginView β HomeView
From HomeView and any other controllers, one screen appears with the name "Settings", in which there is a button "Exit". When clicking this button, the screen will be displayed in LoginView in the usual case.
- (IBAction)btnLogoutSelected:(id)sender { NSArray *navArr=self.navigationController.viewControllers; for (UIViewController *nav in navArr) { if ([nav isKindOfClass:[LoginViewController class]]) { [self.navigationController popToViewController:nav animated:YES]; } } }
As soon as the user is registered, and if the user has logged in once, the application has an autoload function. Therefore, at that time, LoginView will not appear in the navigation list. Therefore, in this scenario, the above code does not work. Therefore, at that time I can not enter LoginView. I need help solving this problem. thanks in advance
source share