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;

}

上一篇 下一篇

猜你喜欢

热点阅读