From c2d43c9dea40b8756ff2513593252ee807f383a9 Mon Sep 17 00:00:00 2001 From: Ege Akpinar Date: Wed, 26 Feb 2014 11:41:57 +0000 Subject: [PATCH 1/3] Fixed display bug when status bar is hidden --- TWStatus/TWStatus.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/TWStatus/TWStatus.m b/TWStatus/TWStatus.m index 417372a..76ec7d2 100644 --- a/TWStatus/TWStatus.m +++ b/TWStatus/TWStatus.m @@ -124,12 +124,22 @@ - (void)layoutForOrientation { case UIInterfaceOrientationLandscapeRight: t = CGAffineTransformMakeRotation(M_PI_2); - frame = CGRectMake(sizeAppFrame.width, 0, kTWStatusHeight, sizeAppFrame.height); + if ([UIApplication sharedApplication].statusBarHidden) { + frame = CGRectMake(sizeAppFrame.width-kTWStatusHeight, 0, kTWStatusHeight, sizeAppFrame.height); + } + else { + frame = CGRectMake(sizeAppFrame.width, 0, kTWStatusHeight, sizeAppFrame.height); + } break; case UIInterfaceOrientationPortraitUpsideDown: t = CGAffineTransformMakeRotation(M_PI); - frame = CGRectMake(0, sizeAppFrame.height, sizeAppFrame.width, kTWStatusHeight); + if ([UIApplication sharedApplication].statusBarHidden) { + frame = CGRectMake(0, sizeAppFrame.height - kTWStatusHeight, sizeAppFrame.width, kTWStatusHeight); + } + else { + frame = CGRectMake(0, sizeAppFrame.height, sizeAppFrame.width, kTWStatusHeight); + } break; } // Apply transform From 6396cfd24bffee9485dd40c0606e4ac1b5c39583 Mon Sep 17 00:00:00 2001 From: Ege Akpinar Date: Tue, 22 Apr 2014 10:49:07 +0100 Subject: [PATCH 2/3] Fix for a change in iOS7.1 --- TWStatus/TWStatus.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/TWStatus/TWStatus.m b/TWStatus/TWStatus.m index 76ec7d2..a796799 100644 --- a/TWStatus/TWStatus.m +++ b/TWStatus/TWStatus.m @@ -98,8 +98,18 @@ + (void)dismissAfter:(NSTimeInterval)interval{ #pragma mark - orientation - (void)handleOrientationChange:(NSNotification *)notif { - [self layoutForOrientation]; - [self layout]; + // NOTE- In iOS7.1, statusBarOrientation property returns final value after the orientation is completed + // Hence do the layout with delay + if ([UIDevice currentDevice].systemVersion.floatValue >= 7.1) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(([UIApplication sharedApplication].statusBarOrientationAnimationDuration + .1) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self layoutForOrientation]; + [self layout]; + }); + } + else { + [self layoutForOrientation]; + [self layout]; + } } #pragma mark - private From b65436a2c14451a91352840c1b37fdc30bd45c50 Mon Sep 17 00:00:00 2001 From: Ege Akpinar Date: Fri, 2 May 2014 16:27:11 +0100 Subject: [PATCH 3/3] Tiny nasty bug fix, which cause problems with iOS version checking --- TWStatus/TWStatus.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TWStatus/TWStatus.m b/TWStatus/TWStatus.m index a796799..22be2b3 100644 --- a/TWStatus/TWStatus.m +++ b/TWStatus/TWStatus.m @@ -100,7 +100,7 @@ + (void)dismissAfter:(NSTimeInterval)interval{ - (void)handleOrientationChange:(NSNotification *)notif { // NOTE- In iOS7.1, statusBarOrientation property returns final value after the orientation is completed // Hence do the layout with delay - if ([UIDevice currentDevice].systemVersion.floatValue >= 7.1) { + if ([UIDevice currentDevice].systemVersion.floatValue >= 7.09) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(([UIApplication sharedApplication].statusBarOrientationAnimationDuration + .1) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self layoutForOrientation]; [self layout];