- (UIView *)currentView{
UIViewController *controller = [[[UIApplication sharedApplication] keyWindow] rootViewController];
if ([controller isKindOfClass:[UITabBarController class]]) {
controller = [(UITabBarController *)controller selectedViewController];
}
if([controller isKindOfClass:[UINavigationController class]]) {
controller = [(UINavigationController *)controller visibleViewController];
}
if (!controller) {
return [UIApplication sharedApplication].keyWindow;
}
return controller.view;
}
网友评论