Compare commits

...

10 Commits

Author SHA1 Message Date
Cezary Wojcik e7d66aefe3 2.3.4 2016-01-07 23:57:28 -08:00
Cezary Wojcik 7eb79da4f0 2.3.3 2015-08-27 09:54:57 -07:00
Cezary Wojcik 0c103128dd actually fixed conflict 2015-08-25 12:36:24 -07:00
Cezary Wojcik fac5c91daa fixed conflict 2015-08-25 12:34:49 -07:00
Cezary Wojcik 5c949092f5 2.3.2 2015-08-25 12:32:49 -07:00
Cezary Wojcik cdc51f3243 Update README.md 2015-08-08 18:45:36 -07:00
Cezary Wojcik 7d1890f7c5 fixed typo in README 2015-07-12 19:15:12 -07:00
Cezary Wojcik 26d6eda4f5 updated README 2015-07-12 19:14:42 -07:00
Cezary Wojcik 9dfcc29703 2015 2015-07-11 23:13:16 -07:00
Cezary Wojcik 6d00f770ef supported interface orientations 2015-07-11 14:53:09 -07:00
5 changed files with 43 additions and 37 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CWStatusBarNotification"
s.version = "2.3.1"
s.version = "2.3.4"
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"
@@ -143,8 +143,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;
/**
@@ -194,13 +194,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 +248,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 +259,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 +305,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 +364,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 +376,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 +530,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
self.isCustomView = YES;
self.notificationIsShowing = YES;
// create UIWindow
// create window
[self createNotificationWindow];
// setup view
+1 -1
View File
@@ -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
+7 -6
View File
@@ -2,7 +2,7 @@
[![Build Status](https://travis-ci.org/cezarywojcik/CWStatusBarNotification.png?branch=master)](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.4'`
### 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