From fb03d626100bee2a6397226136b09b798c867545 Mon Sep 17 00:00:00 2001 From: David Sinclair Date: Tue, 10 May 2016 21:47:18 -0700 Subject: [PATCH] iOS: fixed #913 (iPad layout issue with landscape) --- .../ios/Classes/NBContainerViewController.m | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/clients/ios/Classes/NBContainerViewController.m b/clients/ios/Classes/NBContainerViewController.m index 72465f63c..520838d97 100644 --- a/clients/ios/Classes/NBContainerViewController.m +++ b/clients/ios/Classes/NBContainerViewController.m @@ -213,19 +213,12 @@ leftBorder.hidden = NO; } - if (!self.feedDetailIsVisible) { - [self layoutDashboardScreen]; - } else if (!self.originalViewIsVisible) { - [self layoutFeedDetailScreen]; - } + [self adjustLayout]; } completion:^(id _Nonnull context) { // leftBorder.frame = CGRectMake(0, 0, 1, CGRectGetHeight(self.view.bounds)); - if (!self.feedDetailIsVisible) { - [self layoutDashboardScreen]; - } else if (!self.originalViewIsVisible) { - [self layoutFeedDetailScreen]; - } + [self adjustLayout]; + if (self.feedDetailIsVisible) { // Defer this in the background, to avoid misaligning the detail views if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) { @@ -241,6 +234,18 @@ }]; } +- (void)adjustLayout { + if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { + return; + } + + if (!self.feedDetailIsVisible) { + [self layoutDashboardScreen]; + } else if (!self.originalViewIsVisible) { + [self layoutFeedDetailScreen]; + } +} + - (void)delayedReorientPages { [self.storyPageControl reorientPages]; [[UIApplication sharedApplication] endBackgroundTask:self.reorientBackgroundTask];