Commit c92e1ea authored and committed Jun 25, 2018
1 parent bb76d5a commit c92e1ea Copy full SHA for c92e1ea
File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -113,15 +113,27 @@ - (void)showDebug {
113
113
114
114
self.debugVC .viewControllers = @[nav1,nav2,nav3];
115
115
UIViewController* vc = [[[UIApplication sharedApplication ].delegate window ] rootViewController ];
116
- UIViewController* vc2 = vc. presentedViewController ;
117
- [vc2?:vc presentViewController: self .debugVC animated: YES completion: nil ];
116
+ UIViewController* vc2 = [ self getVisibleViewControllerFrom: vc] ;
117
+ [vc2 presentViewController: self .debugVC animated: YES completion: nil ];
118
118
}
119
119
else {
120
120
[self .debugVC dismissViewControllerAnimated: YES completion: nil ];
121
121
self.debugVC = nil ;
122
122
}
123
123
}
124
-
124
+ -(UIViewController *) getVisibleViewControllerFrom : (UIViewController *) vc {
125
+ if ([vc isKindOfClass: [UINavigationController class ]]) {
126
+ return [self getVisibleViewControllerFrom: [((UINavigationController *) vc) visibleViewController ]];
127
+ } else if ([vc isKindOfClass: [UITabBarController class ]]) {
128
+ return [self getVisibleViewControllerFrom: [((UITabBarController *) vc) selectedViewController ]];
129
+ } else {
130
+ if (vc.presentedViewController ) {
131
+ return [self getVisibleViewControllerFrom: vc.presentedViewController];
132
+ } else {
133
+ return vc;
134
+ }
135
+ }
136
+ }
125
137
- (void )timerMonitor {
126
138
unsigned long long used = [JxbMemoryHelper bytesOfUsedMemory ];
127
139
NSString * text = [self number2String: used];
You can’t perform that action at this time.
0 commit comments