Skip to content

Commit b85562c

Browse files
committed
handle cascade childViewController
1 parent 4581357 commit b85562c

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

SIAlertView/SIAlertView.m

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,20 @@ - (UIViewController *)viewControllerForStatusBarStyle
6969
{
7070
UIViewController *currentViewController = [self currentViewController];
7171

72-
if ([currentViewController childViewControllerForStatusBarStyle]) {
73-
return [currentViewController childViewControllerForStatusBarStyle];
74-
} else {
75-
return currentViewController;
72+
while ([currentViewController childViewControllerForStatusBarStyle]) {
73+
currentViewController = [currentViewController childViewControllerForStatusBarStyle];
7674
}
75+
return currentViewController;
7776
}
7877

7978
- (UIViewController *)viewControllerForStatusBarHidden
8079
{
8180
UIViewController *currentViewController = [self currentViewController];
8281

83-
if ([currentViewController childViewControllerForStatusBarHidden]) {
84-
return [currentViewController childViewControllerForStatusBarHidden];
85-
} else {
86-
return currentViewController;
82+
while ([currentViewController childViewControllerForStatusBarHidden]) {
83+
currentViewController = [currentViewController childViewControllerForStatusBarHidden];
8784
}
85+
return currentViewController;
8886
}
8987

9088
@end

0 commit comments

Comments
 (0)