Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 195e99c68d | |||
| 029ba7943c | |||
| 9c1d49b094 | |||
| 477c95fb94 | |||
| 4e12eb580f | |||
| e7d66aefe3 | |||
| 7eb79da4f0 | |||
| 0c103128dd | |||
| fac5c91daa | |||
| 5c949092f5 | |||
| cdc51f3243 | |||
| 7d1890f7c5 | |||
| 26d6eda4f5 | |||
| 9dfcc29703 | |||
| 6d00f770ef |
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "CWStatusBarNotification"
|
||||
s.version = "2.3.1"
|
||||
s.version = "2.3.5"
|
||||
s.summary = "A library that creates status bar notifications."
|
||||
s.description = "CWStatusBarNotification is a library allows you to present a beautiful text-based notification in the status bar."
|
||||
s.homepage = "https://github.com/cezarywojcik/CWStatusBarNotification"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Copyright (c) 2015 Cezary Wojcik. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
* @brief A simple completion used for handling tapping the notification.
|
||||
*/
|
||||
@@ -143,8 +145,9 @@ typedef NS_ENUM(NSInteger, CWNotificationAnimationType) {
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL multiline;
|
||||
/**
|
||||
* The supported interface orientations. Default value is
|
||||
* @c UIInterfaceOrientationMaskAll.
|
||||
* The supported interface orientations. Default value is the
|
||||
* @c supportedInterfaceOrientations value of the root view controller of the
|
||||
* application.
|
||||
*/
|
||||
@property (nonatomic) UIInterfaceOrientationMask supportedInterfaceOrientations;
|
||||
/**
|
||||
|
||||
@@ -106,6 +106,8 @@
|
||||
|
||||
@implementation CWViewController
|
||||
|
||||
@synthesize preferredStatusBarStyle = _preferredStatusBarStyle;
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
return _preferredStatusBarStyle;
|
||||
@@ -194,13 +196,17 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// set default
|
||||
self.notificationLabelBackgroundColor = [[UIApplication sharedApplication] delegate].window.tintColor;
|
||||
if ([[[UIApplication sharedApplication] delegate] respondsToSelector:@selector(window)]) {
|
||||
self.notificationLabelBackgroundColor = [[UIApplication sharedApplication] delegate].window.tintColor;
|
||||
} else {
|
||||
self.notificationLabelBackgroundColor = [UIColor blackColor];
|
||||
}
|
||||
self.notificationLabelTextColor = [UIColor whiteColor];
|
||||
self.notificationLabelFont = [UIFont systemFontOfSize:FONT_SIZE];
|
||||
self.notificationLabelHeight = 0.0;
|
||||
self.customView = nil;
|
||||
self.multiline = NO;
|
||||
self.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll;
|
||||
self.supportedInterfaceOrientations = [UIApplication sharedApplication].keyWindow.rootViewController.supportedInterfaceOrientations;
|
||||
self.notificationAnimationDuration = 0.25;
|
||||
self.notificationStyle = CWNotificationStyleStatusBarNotification;
|
||||
self.notificationAnimationInStyle = CWNotificationAnimationStyleBottom;
|
||||
@@ -244,7 +250,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
if (SYSTEM_VERSION_LESS_THAN(@"8.0") && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
return [UIScreen mainScreen].bounds.size.height;
|
||||
}
|
||||
return [UIScreen mainScreen].bounds.size.width;
|
||||
return [[UIApplication sharedApplication] keyWindow].bounds.size.width;
|
||||
}
|
||||
|
||||
- (CGFloat)getStatusBarOffset
|
||||
@@ -255,6 +261,27 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
- (CGFloat)getNavigationBarHeight
|
||||
{
|
||||
if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ||
|
||||
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
return 44.0f;
|
||||
}
|
||||
return 30.0f;
|
||||
}
|
||||
|
||||
- (CGFloat)getNotificationLabelHeight
|
||||
{
|
||||
switch (self.notificationStyle) {
|
||||
case CWNotificationStyleStatusBarNotification:
|
||||
return [self getStatusBarHeight];
|
||||
case CWNotificationStyleNavigationBarNotification:
|
||||
return [self getStatusBarHeight] + [self getNavigationBarHeight];
|
||||
default:
|
||||
return [self getStatusBarHeight];
|
||||
}
|
||||
}
|
||||
|
||||
- (CGRect)getNotificationLabelTopFrame
|
||||
{
|
||||
return CGRectMake(0, [self getStatusBarOffset] + -1*[self getNotificationLabelHeight], [self getStatusBarWidth], [self getNotificationLabelHeight]);
|
||||
@@ -280,27 +307,6 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
return CGRectMake(0, [self getStatusBarOffset], [self getStatusBarWidth], [self getNotificationLabelHeight]);
|
||||
}
|
||||
|
||||
- (CGFloat)getNavigationBarHeight
|
||||
{
|
||||
if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ||
|
||||
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
return 44.0f;
|
||||
}
|
||||
return 30.0f;
|
||||
}
|
||||
|
||||
- (CGFloat)getNotificationLabelHeight
|
||||
{
|
||||
switch (self.notificationStyle) {
|
||||
case CWNotificationStyleStatusBarNotification:
|
||||
return [self getStatusBarHeight];
|
||||
case CWNotificationStyleNavigationBarNotification:
|
||||
return [self getStatusBarHeight] + [self getNavigationBarHeight];
|
||||
default:
|
||||
return [self getStatusBarHeight];
|
||||
}
|
||||
}
|
||||
|
||||
# pragma mark - screen orientation change
|
||||
|
||||
- (void)updateStatusBarFrame
|
||||
@@ -360,7 +366,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self.customView addSubview:view];
|
||||
|
||||
// Setup Auto Layout constaints so that the custom view that is added is constained to be the same
|
||||
// Setup Auto Layout constaints so that the custom view that is added is consrtained to be the same
|
||||
// size as its superview, whose frame will be altered
|
||||
[self.customView addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.customView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0]];
|
||||
[self.customView addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.customView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]];
|
||||
@@ -372,7 +378,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
|
||||
- (void)createNotificationWindow
|
||||
{
|
||||
self.notificationWindow = [[CWWindowContainer alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.notificationWindow = [[CWWindowContainer alloc] initWithFrame:[[[UIApplication sharedApplication] keyWindow] bounds]];
|
||||
self.notificationWindow.backgroundColor = [UIColor clearColor];
|
||||
self.notificationWindow.userInteractionEnabled = YES;
|
||||
self.notificationWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
@@ -526,7 +532,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
self.isCustomView = YES;
|
||||
self.notificationIsShowing = YES;
|
||||
|
||||
// create UIWindow
|
||||
// create window
|
||||
[self createNotificationWindow];
|
||||
|
||||
// setup view
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
Copyright (c) 2015 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://travis-ci.org/cezarywojcik/CWStatusBarNotification)
|
||||
|
||||
**NOTE:** You can find a `Swift` implementation of this library [in the swift branch of this repo](https://github.com/cezarywojcik/CWStatusBarNotification/tree/swift). This version is currently somewhat outdated, but a new one with Swift 2.0 will be coming soon!
|
||||
**NOTE:** You can find a **Swift 2.0** implementation of this library [in the swift branch of this repo](https://github.com/cezarywojcik/CWStatusBarNotification/tree/swift).
|
||||
|
||||
`CWStatusBarNotification` is a library that allows you to easily create text-based notifications that appear on the status bar.
|
||||
|
||||
@@ -20,7 +20,7 @@ Works for iPhone and iPad.
|
||||
|
||||
### CocoaPods
|
||||
|
||||
`pod 'CWStatusBarNotification', '~> 2.3.1'`
|
||||
`pod 'CWStatusBarNotification', '~> 2.3.5'`
|
||||
|
||||
### Manual
|
||||
|
||||
@@ -142,17 +142,18 @@ The notifications will work in both screen orientations, however, screen rotatio
|
||||
|
||||
## Apps Using This Library
|
||||
|
||||
If you would like for your app to be featured here, [contact me](cezarywojcik.com/contact) and I would love to hear about your app!
|
||||
If you would like for your app to be featured here, [contact me](http://cezarywojcik.com/contact) and I would love to hear about your app!
|
||||
|
||||
* [SlideShare Presentations](https://itunes.apple.com/app/id917418728)
|
||||
* [Pong Ping](https://itunes.apple.com/us/app/pong-ping-social-addictive/id822887888)
|
||||
* [SlideShare Presentations](https://itunes.apple.com/app/id917418728)
|
||||
* [Pong Ping](https://itunes.apple.com/us/app/pong-ping-social-addictive/id822887888)
|
||||
* [NextMovies](https://itunes.apple.com/us/app/nextmovies-smart-movie-recommendation/id680850329)
|
||||
* [Social Dummy](https://itunes.apple.com/gb/app/social-dummy-create-fake-social/id610088272)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
Copyright (c) 2015 Cezary Wojcik <http://www.cezarywojcik.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
Reference in New Issue
Block a user