Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarywojcik committed Sep 19, 2013
1 parent 0c22577 commit 15047c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CWStatusBarNotification.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CWStatusBarNotification"
s.version = "1.0.0"
s.version = "1.0.1"
s.summary = "A category on UIViewController to show a text notification in the status bar."
s.description = "CWStatusBarNotification adds a category on UIViewController that allows you to present a text-based notification in the status bar."
s.homepage = "http://github.com/cezarywojcik/CWStatusBarNotification"
Expand Down
18 changes: 15 additions & 3 deletions CWStatusBarNotification/UIViewController+CWStatusBarNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ @implementation UIViewController (CWStatusBarNotification);
NSString const *CWStatusBarNotificationIsShowingKey = @"CWStatusBarNotificationIsShowingKey";
NSString const *CWStatusBarNotificationLabelKey = @"CWStatusBarNotificationLabelKey";

# pragma mark - helper functions
# pragma mark - overriding functions
// The below functions produce warnings - not an issue

- (BOOL)prefersStatusBarHidden {
Expand All @@ -30,6 +30,18 @@ - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationSlide;
}

# pragma mark - helper functions

- (void)updateStatusBar {
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self setNeedsStatusBarAppearanceUpdate];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:self.statusBarIsHidden withAnimation:self.preferredStatusBarUpdateAnimation];
}
}

# pragma mark - dimensions

- (CGFloat)getStatusBarWidth {
Expand Down Expand Up @@ -61,7 +73,7 @@ - (void)showStatusBarNotification:(NSString *)message forDuration:(CGFloat)durat
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenOrientationChanged) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
self.statusBarIsHidden = YES;
[self setNeedsStatusBarAppearanceUpdate];
[self updateStatusBar];
self.statusBarNotificationLabel.frame = [self getStatusBarFrame];
} completion:^(BOOL finished) {
[UIView animateWithDuration:duration - 2*STATUS_BAR_ANIMATION_LENGTH animations:^{
Expand All @@ -71,7 +83,7 @@ - (void)showStatusBarNotification:(NSString *)message forDuration:(CGFloat)durat
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[UIView animateWithDuration:STATUS_BAR_ANIMATION_LENGTH animations:^{
self.statusBarIsHidden = NO;
[self setNeedsStatusBarAppearanceUpdate];
[self updateStatusBar];
self.statusBarNotificationLabel.frame = [self getStatusBarHiddenFrame];
} completion:^(BOOL finished) {
[self.statusBarNotificationLabel removeFromSuperview];
Expand Down

0 comments on commit 15047c5

Please # to comment.