iOS获取栈中顶层controller
2015-11-12 本文已影响71人
小雨hahaha
+ (UIViewController *)stackTopViewController
{
UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
UIViewController *topVC = rootVC;
while (topVC.presentedViewController) {
topVC = topVC.presentedViewController;
}
return topVC;
}