我有一个基于菜单的导航。该菜单是一个tableView。每当用户按下该表中的一个条目时,我想切换到另一个视图控制器,并且如果有推送的任何视图,我想首先清理导航堆栈。等到popToRootViewControllerAnimated:YES动画完成
这是我在做什么
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[(UINavigationController *)self.tabBar.selectedViewController popToRootViewControllerAnimated:YES];
self.tabBar.selectedIndex = indexPath.row;
}
但
self.tabBar.selectedIndex = indexPath.row;
不要让popToRoot动画完成。有什么方法可以知道动画何时完成?
感谢
这是不可预知的,我 - 当我推了该块多以后执行新视图控制器 – diachedelic
块应该在CATransaction结束时执行,并且除rootViewController之外的所有控制器都会弹出。你可以尝试另一种转变吗?例如使用[self.navigationController popViewControllerAnimated:YES];而不是popToRootViewControllerAnimated,或尝试没有动画。 – buttcmd