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;
Don’t let the popToRoot animation complete. Is there a way to know when the animation completes?
Thank you
You can write code in rootViewControllers – (void)viewDidAppear: (BOOL) animation
If you want to I think there are two ways to write code in the ViewController:
1. Add a delegate in rootViewController, when calling-(void)viewDidAppear: (BOOL) when the animation uses the delegate to send messages
2. Add a notification in rootViewController, when calling-(void)viewDidAppear: (BOOL) animation to publish notifications. In your current ViewController, you can receive notifications
< /p>
I have a menu-based navigation. The menu is tableView. Whenever the user presses an entry in the table, I want to switch to another view controller, if any view is pushed, I want First clean up the navigation stack.
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;
Don’t let The popToRoot animation is complete. Is there a way to know when the animation is complete?
Thank you
In rootViewController, when rootViewController calls – (void)viewDidAppear: (BOOL) animation, it means the animation is complete. < p>
You can write code in rootViewControllers-(void)viewDidAppear: (BOOL)animation
If you want to write code in the current ViewController, I think there are two types Method:
1. Add a delegate in rootViewController, when calling – (void)viewDidAppear: (BOOL) animation uses delegate to send messages
2. Add a notification in rootViewController , When calling – (void)viewDidAppear: (BOOL) animation to publish notifications. In your current ViewController, you can receive notifications