美文网首页
iOS获取栈中顶层controller

iOS获取栈中顶层controller

作者: 小雨hahaha | 来源:发表于2015-11-12 22:07 被阅读71次

+ (UIViewController *)stackTopViewController

{

          UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;

          UIViewController *topVC = rootVC;

          while (topVC.presentedViewController) {

                 topVC = topVC.presentedViewController;

           } 

            return topVC;

}

相关文章

网友评论

      本文标题:iOS获取栈中顶层controller

      本文链接:https://www.haomeiwen.com/subject/drohhttx.html