Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #11 from shoumikhin/master
Browse files Browse the repository at this point in the history
Status bar fixes
  • Loading branch information
bastos committed Jun 26, 2014
2 parents 1300644 + c277345 commit 19a787b
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions CMNavBarNotificationView/CMNavBarNotificationView.m
Expand Up @@ -13,6 +13,7 @@

#define kCMNavBarNotificationHeight 44.0f
#define kCMNavBarNotificationIPadWidth 480.0f
#define kCMNavBarNotificationDuration 2.0f
#define RADIANS(deg) ((deg) * M_PI / 180.0f)

NSString *kCMNavBarNotificationViewTapReceivedNotification = @"kCMNavBarNotificationViewTapReceivedNotification";
Expand All @@ -29,7 +30,7 @@ @interface CMNavBarNotificationWindow : UIWindow
@implementation CMNavBarNotificationWindow

+ (CGRect)notificationRectWithOrientation:(UIInterfaceOrientation)orientation {
CGFloat statusBarHeight = 20.0f;
CGFloat statusBarHeight = MIN(UIApplication.sharedApplication.statusBarFrame.size.width, UIApplication.sharedApplication.statusBarFrame.size.height);
if ([UIApplication sharedApplication].statusBarHidden) statusBarHeight = 0.0f;
if (UIDeviceOrientationIsLandscape(orientation)) {

Expand All @@ -54,18 +55,6 @@ - (id)initWithFrame:(CGRect)frame {
self.backgroundColor = [UIColor clearColor];
_notificationQueue = [[NSMutableArray alloc] initWithCapacity:4];

UIView *topHalfBlackView = [[UIView alloc]
initWithFrame:CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame),
CGRectGetWidth(frame),
0.5 * CGRectGetHeight(frame))];

topHalfBlackView.backgroundColor = [UIColor blackColor];
topHalfBlackView.layer.zPosition = -100;
topHalfBlackView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

[self addSubview:topHalfBlackView];

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(willRotateScreen:)
Expand Down Expand Up @@ -110,7 +99,7 @@ - (void)rotateStatusBarAnimatedWithFrame:(CGRect)frame andOrientation:(UIInterfa

- (void)rotateStatusBarWithFrame:(CGRect)frame andOrientation:(UIInterfaceOrientation)orientation {
BOOL isPortrait = UIDeviceOrientationIsPortrait(orientation);
CGFloat statusBarHeight = 20.0f;
CGFloat statusBarHeight = MIN(UIApplication.sharedApplication.statusBarFrame.size.width, UIApplication.sharedApplication.statusBarFrame.size.height);
if ([UIApplication sharedApplication].statusBarHidden) statusBarHeight = 0.0f;
if (isPortrait) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
Expand Down Expand Up @@ -259,7 +248,7 @@ - (id)initWithFrame:(CGRect)frame {
}

+ (CMNavBarNotificationView *)notifyWithText:(NSString *)text andDetail:(NSString *)detail {
return [self notifyWithText:text detail:detail andDuration:2.0f];
return [self notifyWithText:text detail:detail andDuration:kCMNavBarNotificationDuration];
}

+ (CMNavBarNotificationView *)notifyWithText:(NSString *)text detail:(NSString *)detail andDuration:(NSTimeInterval)duration {
Expand Down Expand Up @@ -287,7 +276,7 @@ + (CMNavBarNotificationView *)notifyWithText:(NSString *)text detail:(NSString *
return [self notifyWithText:text
detail:detail
image:nil
duration:2.0
duration:kCMNavBarNotificationDuration
andTouchBlock:block];
}

Expand Down

0 comments on commit 19a787b

Please sign in to comment.