Tuesday, 15 July 2014

ios - UINavigationController popToViewController issue -


I am using UINavigationController to handle controller navigation

In the general case

Registration View - & gt; Log Inview - & gt; Homeview

From Homeview & amp; Any other next controllers there is a setting called a screen is being opened which is the logout button. This button will pop up on the login screen of the screen as usual.

  - (IBAction) btnLogout selected: (ID) sender {NSArray * navArr = self.navigationController.viewControllers; (Nav in NaviRr) * if ([nav isKindOfClass: [LoginViewController class]]) {[self.navigationController popToViewController: nav animated: yes]; }}}   

Once the user is registered & amp; If the user is logged in at one time, the application here itself will not be in the logview navigation count at that time. Therefore, the position above the code is not working in this scenario. So at that time I am not able to go to the loginview. I need help in solving this issue thanks in advance

If you have LoginViewController There is no example of a on the navigation stack, just create it:

  log in VIPU controller * LoginController = [[Log-in Visual Controller Alloc] INS]; // With appropriate init ... method   

then you can use the property of the viewControllers UINavigationController. You can change the current view controller with the loginController , or enter loginController to pop on the given index.

  NSMutableArray * newViewControllers = [self .navigationController.viewControllers mutableCopy]; [New Visual Controller ObjectExtends: [NewWeCentors Index of Object: Self] with Object: Login Controller]; [Self. Navigation Controller Setview Controller: Animated New Visual Controller: Yes];    

No comments:

Post a Comment