問題
//通過如下跳轉(zhuǎn),通過xcode 的debug view hierarchy的工具發(fā)現(xiàn)UITransitionView沒有移除掉導(dǎo)致當(dāng)前的控制器沒有釋放掉
UIStoryboard *storyboard =
[UIStoryboard storyboardWithName:kStoryboardName_Main
bundle:nil];
UIViewController *mainBoard =
[storyboard instantiateViewControllerWithIdentifier:
kStoryboardID_MainTabBarController];
[UIApplication sharedApplication].delegate.window.rootViewController = mainBoard;
[[UIApplication sharedApplication].delegate.window makeKeyAndVisible];
解決辦法
//通過xcode工具檢測到UITransitionView沒釋放導(dǎo)致當(dāng)前控制器無法釋放 為此要先移除該視圖,之后再把導(dǎo)航欄pop掉,最后再切換根視圖
for (UIView *subview in [UIApplication sharedApplication].delegate.window.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"UITransitionView")]) {
[subview removeFromSuperview];
}
}