blob: 746fdd8db854d413c7c472df9775a1a62c08b232 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#import "UIViewController+MGLAdditions.h"
@implementation UIViewController (MGLAdditions)
- (UIViewController *)mgl_topMostViewController
{
if ([self isKindOfClass:[UINavigationController class]])
{
return [[(UINavigationController *)self visibleViewController] mgl_topMostViewController];
}
else if ([self isKindOfClass:[UITabBarController class]])
{
return [[(UITabBarController *)self selectedViewController] mgl_topMostViewController];
}
else if (self.presentedViewController)
{
return [self.presentedViewController mgl_topMostViewController];
}
return self;
}
@end
|