iOS 获取当前控制器ViewController

2017-05-18  本文已影响19人  Bager
+ (UIViewController *)getPresentVC
{
    UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
    UIViewController *topVC = appRootVC;
    if (topVC.presentedViewController) 
    {
        topVC = topVC.presentedViewController;
    }
    
    return topVC;
}
上一篇下一篇

猜你喜欢

热点阅读