I want to mark that my UINavigationController
is animating (push/pop) or not.
I have a BOOL variable (_isAnimating), and the the code below seem work:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
_isAnimating = YES;
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
_isAnimating = NO;
}
But it work incorrectly in iOS7 with swipe gesture. Assume my navigation is: root-> view A -> view B . I'm currently on B.
In begin of swipe (go back from B to A), the funcion "
navigationController:willShowViewController:animated:(BOOL)animated
" is called, then_isAnimating = YES
.The normal case is the swipe is finished (go back to A), the function "
navigationController:didShowViewController:animated:(BOOL)animated
" is called, then_isAnimating = NO
. This case is OK, but:If the user may just swipe a half (half transition to A), then don't want to swipe to the previous view (view A), he go to the current view again (stay B again). Then the function "
navigationController:didShowViewController:animated:(BOOL)animated
" is not called, my variable has incorrect value(_isAnimating=YES)
.
I have no chance to update my variable in this abnormal case. Is there any way to update the state of navigation? Thank you!
viewWillAppear:
? – Reube