当我使用[UITabBarController setSelectedIndex:]和-popToRootViewControllerAnimated:时,例如:
- (void)backViewControllerAnimation:(BOOL)animation {
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
[OLTabBarController.defaultTabBar.tabBarController setSelectedIndex:0];
[self.navigationController popToRootViewControllerAnimated:YES];
}
viewController不会取消分配,但是如果我删除[UITabBarController setSelectedIndex:0],就像这样:
- (void)backViewControllerAnimation:(BOOL)animation {
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
[self.navigationController popToRootViewControllerAnimated:YES];
}
viewController可以取消分配,我想知道发生了什么,我需要-setSelectedIndex:方法,如何使viewController执行-dealloc方法?