Skip to content

Commit 59899c4

Browse files
author
Jeff Arena
committed
Take a slightly different approach to addressing ECSlidingViewController#204.
1 parent eb204a1 commit 59899c4

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.m

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -560,22 +560,25 @@ - (CGFloat)resettedCenter
560560
- (CGRect)fullViewBounds
561561
{
562562
CGFloat statusBarHeight = 0.0f;
563-
564-
BOOL legacyScreenHeightEnabled = NO;
565-
if (floor(NSFoundationVersionNumber) <= 993.00) {
566-
legacyScreenHeightEnabled = YES;
567-
}
563+
564+
/**
565+
Enable legacy screen height support if we are running on an SDK prior to iOS 6
566+
and thus does not support the supportedInterfaceOrientationsForWindow: selector on
567+
UIApplication, which was introduced in iOS 6
568+
*/
569+
UIApplication *sharedApplication = [UIApplication sharedApplication];
570+
BOOL legacyScreenHeightEnabled = ![sharedApplication respondsToSelector:@selector(supportedInterfaceOrientationsForWindow:)];
568571

569572
if (self.shouldAdjustChildViewHeightForStatusBar || legacyScreenHeightEnabled) {
570-
statusBarHeight = CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
571-
if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
572-
statusBarHeight = CGRectGetWidth([UIApplication sharedApplication].statusBarFrame);
573+
statusBarHeight = sharedApplication.statusBarFrame.size.height;
574+
if (UIInterfaceOrientationIsLandscape(sharedApplication.statusBarOrientation)) {
575+
statusBarHeight = sharedApplication.statusBarFrame.size.width;
573576
}
574577
}
575578

576579
CGRect bounds = [UIScreen mainScreen].bounds;
577580

578-
if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
581+
if (UIInterfaceOrientationIsLandscape(sharedApplication.statusBarOrientation)) {
579582
CGFloat height = CGRectGetWidth(bounds);
580583
CGFloat width = CGRectGetHeight(bounds);
581584
bounds.size.height = height;

0 commit comments

Comments
 (0)