I have a menu based navigation. The menu is a tableView. Everytime a user presses one entry in that table I want to switch to another viewcontroller, and if there is any view pushed I want to clean the navigation stack first.
This is what I am doing
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[(UINavigationController *)self.tabBar.selectedViewController popToRootViewControllerAnimated:YES];
self.tabBar.selectedIndex = indexPath.row;
}
But
self.tabBar.selectedIndex = indexPath.row;
Dont let the popToRoot animation finish. Is there any way to know when the animation is done?
Thanks
in your rootViewController , when you rootViewController invoke the
- (void)viewDidAppear:(BOOL)animatedit means the animation is finish.You can code in the rootViewControllers
- (void)viewDidAppear:(BOOL)animatedIf you want must code in your current ViewController , I think it has 2 ways:
1.add a
delegatein the rootViewController , when invoke the- (void)viewDidAppear:(BOOL)animatedusedelegateto sent the message2.add a notification in the rootViewController,when invoke the
- (void)viewDidAppear:(BOOL)animatedpost a notification . And in your current ViewController you can receive the notification