//在appdelegate? ? 獲取rootVC
? ? ? ? ZFTabBarViewController *rootVC = (ZFTabBarViewController *)[UIApplication sharedApplication].keyWindow.rootViewController;
? ? //取到當(dāng)前展示的tabbar? ?selectedindex 在哪
? ? ? ? ZFNavViewController*navigationVC = rootVC.selectedViewController;
//獲取root? present出來的VC
? ? ? ? ZFNavViewController *navVC = (ZFNavViewController *)[UIApplication sharedApplication].keyWindow.rootViewController.presentedViewController;
if ([[UIApplication sharedApplication].keyWindow.rootViewController.presentedViewController? isKindOfClass:[ZFNavViewController class]]) {
? ? ? ? ? ? [navVC.visibleViewController.navigationController popToRootViewControllerAnimated:NO];
? ?[navVCdismissViewControllerAnimated:YES completion:nil];? ? ? ? ? ? rootVC.selectedIndex=0;
//? ? ? ? ? ? ? ? [[UIApplication sharedApplication].keyWindow.rootViewController.presentedViewController presentViewController:alertAction animated:YES completion:nil];
? ? ? ? }else{
? ? ? ? ? ? [navigationVC.visibleViewController.navigationController popToRootViewControllerAnimated:NO];
? ? ? ? }
? ? ? ? [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertAction animated:YES completion:nil];