forked from Sumi-Interactive/SIAlertView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIWindow+SIUtils.m
More file actions
46 lines (36 loc) · 1.19 KB
/
UIWindow+SIUtils.m
File metadata and controls
46 lines (36 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// UIWindow+SIUtils.m
// SIAlertView
//
// Created by Kevin Cao on 13-11-1.
// Copyright (c) 2013年 Sumi Interactive. All rights reserved.
//
#import "UIWindow+SIUtils.h"
@implementation UIWindow (SIUtils)
- (UIViewController *)currentViewController
{
UIViewController *viewController = self.rootViewController;
while (viewController.presentedViewController) {
viewController = viewController.presentedViewController;
}
return viewController;
}
#ifdef __IPHONE_7_0
- (UIViewController *)viewControllerForStatusBarStyle
{
UIViewController *currentViewController = [self currentViewController];
while ([currentViewController childViewControllerForStatusBarStyle]) {
currentViewController = [currentViewController childViewControllerForStatusBarStyle];
}
return currentViewController;
}
- (UIViewController *)viewControllerForStatusBarHidden
{
UIViewController *currentViewController = [self currentViewController];
while ([currentViewController childViewControllerForStatusBarHidden]) {
currentViewController = [currentViewController childViewControllerForStatusBarHidden];
}
return currentViewController;
}
#endif
@end