方法1 取出當(dāng)前的導(dǎo)航控制器
// 取出當(dāng)前的導(dǎo)航控制器
UITabBarController *tabBarVc = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *nav = (UINavigationController *)tabBarVc.selectedViewController;
[nav pushViewController:web animated:YES];
方法2
XMGPostWordViewController *postWord = [[XMGPostWordViewController alloc] init];
XMGNavigationController *nav = [[XMGNavigationController alloc] initWithRootViewController:postWord];
// 這里不能使用self來彈出其他控制器, 因為self執(zhí)行了dismiss操作
UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController;
[root presentViewController:nav animated:YES completion:nil];
方法3
- (UIViewController *)ViewController
{
UIResponder *next = [self nextResponder];
do {
if ([next isKindOfClass:[UIViewController class]]) {
return (UIViewController *)next;
}
next = [next nextResponder];
} while (next != nil);
return nil;
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者