Appdelegate 获取当前控制器 针对某个控制器单独处理

        UITabBarController *classNameVC =(UITabBarController *) [self getCurrentVC];
        NSLog(@"++++++++%@",classNameVC);
        UINavigationController *selectVC =classNameVC.selectedViewController;
        if ([selectVC.topViewController isKindOfClass:[LMSNewPKWebVC class]]) {
            
        }
        else
        {
            [self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
            self.tabbarController.delegate= self;
            [self.tabbarController setSelectedIndex:1];
            UINavigationController *appNavC = self.tabbarController.viewControllers[1];
            LMSNewPKWebVC *vc = [[LMSNewPKWebVC alloc] init];
            vc.typeStr = @"4";
            vc.urlStr = H5ActivityThroughMap;;
            [appNavC pushViewController:vc animated:YES];
        }

 

 

- (UIViewController *)getCurrentVC
{
        UIViewController *result = nil;
           
        UIWindow * window = [[UIApplication sharedApplication] keyWindow];
        if (window.windowLevel != UIWindowLevelNormal)
            {
                    NSArray *windows = [[UIApplication sharedApplication] windows];
                    for(UIWindow * tmpWin in windows)
                        {
                                if (tmpWin.windowLevel == UIWindowLevelNormal)
                                    {
                                            window = tmpWin;
                                            break;
                                        }
                            }
                }
           
        UIView *frontView = [[window subviews] objectAtIndex:0];
        id nextResponder = [frontView nextResponder];
           
        if ([nextResponder isKindOfClass:[UIViewController class]])
                result = nextResponder;
        else
                result = window.rootViewController;
           
        return result;
}

上一篇:opencv-python视频处理之图片变成视频,视频切成图片


下一篇:opencv-python视频处理之白闪效果