iOS – Wait until PoptorootViewControlleranimated: Yes animation completed

I have a menu-based navigation. The menu is tableView. Whenever the user presses an item in the table, I want to switch to another view controller, if there is any view Being pushed, I want to clean up 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;

Don’t let the popToRoot animation complete. Is there a way to know when the animation completes?

Thank you

In rootViewController, when rootViewController calls – (void)viewDidAppear : (BOOL) animation, it means the animation is complete.

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

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3909 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.