So, hope my tricks can save you days, and welcome sharing, too.
1, To know when the back button of UINativationViewController is clicked, you can try:
(According to here: http://stackoverflow.com/questions/1214965/setting-action-for-back-button-in-navigation-controller/3445994#3445994)
-(void) viewWillDisappear:(BOOL)animated {
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
// back button was pressed. We know this is true because self is no longer
// in the navigation stack.
}
[super viewWillDisappear:animated];
}
2, Skip previous view and go back to previous's previous view, you can try
(e.g. You're at A, and A->B->C, but when back in C, you want to skip B and go to A directly)
a, First, saving current UINavigationViewController to a temporary variable
b, Call popViewControllerAnimated (when you pop, the navigation changed to nil immediately, that's why when you push C doesn't work. You need to save it to a local variable first, retain the couting)
c, Using the one you saved just now to push to show next view C
Continue...
No comments:
Post a Comment