diff options
| -rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 36 | 
1 files changed, 36 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 7079cd73eb1..9a5d5c3691f 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -155,6 +155,22 @@      self.view = [[[QIOSDesktopManagerView alloc] init] autorelease];  } +- (void)viewDidLoad +{ +    [super viewDidLoad]; + +    NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; +    [center addObserver:self selector:@selector(willChangeStatusBarFrame:) +            name:UIApplicationWillChangeStatusBarFrameNotification +            object:[UIApplication sharedApplication]]; +} + +- (void)viewDidUnload +{ +    [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:nil]; +    [super viewDidUnload]; +} +  -(BOOL)shouldAutorotate  {      // Until a proper orientation and rotation API is in place, we always auto rotate. @@ -179,6 +195,26 @@  }  #endif +- (void)willChangeStatusBarFrame:(NSNotification*)notification +{ +    Q_UNUSED(notification); + +    if (self.view.window.screen != [UIScreen mainScreen]) +        return; + +    // UIKit doesn't have a delegate callback for statusbar changes that's run inside the +    // animation block, like UIViewController's willAnimateRotationToInterfaceOrientation, +    // nor does it expose a constant for the duration and easing of the animation. However, +    // though poking at the various UIStatusBar methods, we can observe that the animation +    // uses the default easing curve, and runs with a duration of 0.35 seconds. +    static qreal kUIStatusBarAnimationDuration = 0.35; + +    [UIView animateWithDuration:kUIStatusBarAnimationDuration animations:^{ +        [self.view setNeedsLayout]; +        [self.view layoutIfNeeded]; +    }]; +} +  - (void)viewWillLayoutSubviews  {      if (!QCoreApplication::instance())  | 
