Skip to content

Commit cdd6d89

Browse files
author
Diogo Autilio
committed
Fix rotation on iOS 7.x
1 parent 9eae27a commit cdd6d89

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

SCLAlertView/SCLAlertView.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ - (void)buttonTapped:(SCLButton *)btn
471471

472472
-(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)image color:(UIColor *)color title:(NSString *)title subTitle:(NSString *)subTitle duration:(NSTimeInterval)duration completeText:(NSString *)completeText style:(SCLAlertViewStyle)style
473473
{
474-
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
474+
UIViewController *rootViewController = vc;
475475

476476
self.view.alpha = 0;
477477

@@ -480,9 +480,9 @@ -(SCLAlertViewResponder *)showTitle:(UIViewController *)vc image:(UIImage *)imag
480480
self.backgroundView.frame = vc.view.bounds;
481481

482482
// Add subviews
483-
[window addSubview:_backgroundView];
484-
[window addSubview:self.view];
485-
[vc addChildViewController:self];
483+
[rootViewController addChildViewController:self];
484+
[rootViewController.view addSubview:_backgroundView];
485+
[rootViewController.view addSubview:self.view];
486486

487487
// Alert color/icon
488488
UIColor *viewColor;

0 commit comments

Comments
 (0)