cezarywojcik / cwstatusbarnotification Goto Github PK
View Code? Open in Web Editor NEWA library that allows you to easily create text-based notifications that appear on the status bar.
License: MIT License
A library that allows you to easily create text-based notifications that appear on the status bar.
License: MIT License
It seems that while a notification is active on iOS 7 only, the window stops responding to touch events.
Steps to reproduce:
This only happens on iOS 7 devices
Please support Carthage on the Swift 2 branch. You just need to share the build scheme and push it. Thanks!
It would be cool if you implement an UIImageView to the left side of the notification. So we can display an image.
On iPad it's showing wrong animation while disappearing text.
self.notification.notificationTappedBlock = ^(void) {
if (!weakSelf.notification.notificationIsDismissing)
{
[weakSelf.notification dismissNotification];
// how to do ????
}
};
I think I should tell you this, my company are just trying to find a library that can show notification form the status bar, after examine your code, I think maybe the best way to suit our need is to create a new library with Swift 2.0, the concept is rather same, but I think the architecture is a bit different, the repo is here https://github.com/36Kr-Mobile/StatusBarNotificationCenter, if there is something inappropriate, please let me know, thanks!
I couldn't get it to stick. It appears and immediately disappears. Tested on iPhone5 & iOS7.
Tried on main thread
Tried with VC based status bar On/Off
Tried in AppDelegate as well as viewDidAppear of the first VC
Is there a way to disable rotation? My app does not allow rotation. But if the screen rotates, only the notification view rotates.
Would be great if notification was also shown when status bar is hidden. For now, there are some visual glitches.
I have the following set up and none of the customisations are working :
self.statusBarNotification = [CWStatusBarNotification new];
[self.statusBarNotification displayNotificationWithMessage:@"Fetching stations ..." completion:nil];
// The below lines don't seem to be working ..
self.statusBarNotification.notificationAnimationInStyle = CWNotificationAnimationStyleLeft;
self.statusBarNotification.notificationLabelBackgroundColor = [UIColor clearColor];
self.statusBarNotification.notificationLabelTextColor = [UIColor grayColor];
It'd be cool if this control worked with UINavigationViewController. Right now it just hides the status bar and shows it again.
I think it's because these occur in such quick succession the messages can't be 'queued up'.
Hi,
To comply with Apple guidelines it would be nice to be able to show the notification bar for example under the navigation bar. Instagram and other apps do this.
Would it be possible to add an offset variable so that it's possible to manually set where the notification appears?
Thanks,
Michael
nice work though.
I'd love to be able to pass in a block that would be executed if the user taps on the notification.
Please let me know if you'd be open to a pull request for this.
Xcode 8 warns UIDeviceOrientation
implicit conversion from enumeration type 'UIInterfaceOrientation' (aka 'enum UIInterfaceOrientation') to different enumeration type 'UIDeviceOrientation'
UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.width;
}
Could you implement a user interaction, so the navigationbar can perform an action when the user press on it.
self.notificationLabelBackgroundColor = [[UIApplication sharedApplication] delegate].window.tintColor;
makes my app crash, since we don't implement window in our delegate, since it's an optional property
i have had my own implementation of updateting the statusbarframe since ios8 is providing willtransitiontosize. its much simpler than lay on nsnotification center. had to disable all the observers for your pod to get it working. please consider a proper fix.
anyway, cool pod
Please, release the 2.2.5
with the navbar height calculation fix you merged 4 days ago.
Thank you!
Is there any support for this and/or plan to support this? I'd like to use this library to show status for an upload operation.
When showing a notification with the NavigationBarStyle only the top 20 pts (height of status bar style) of the frame invoke the tap gesture when tapping. When tapping on any other portion of the notification, the tap goes to the window underneath.
When i use notification, then POST json request, then again notification, the second one doesn't apear..
Hey nice job for this class,
But when I try to implementing in my project in the CWStatusBarNotification.m I get this warring MSG "the category is implementing a method which will also be implemented by its primary class" in the
And I think that will be why my app is not showing this status bar!
iOS 7, which im using!
I'm trying to implement CWStatusBarNotification into my app but receive 19 errors from within both the .h and .m files. Some of the errors include:
"Cannot find interface declaration for 'UILabel', superclass of 'ScrollLabel'"
"Unknown type name 'UIColor'"
"Class 'CWWindowContainer' defined without specifying a base class"
From what I can find on the web it seems it may a circular reference issue in one of the header files. I can't seem to figure it out though. Are there frameworks I haven't imported that it depends on?
I'm working in Xcode 6 for iOS 8 in an Objective-C project
This sentence does not work:
self.notification.displayNotificationWithMessage("Hello", completion: nil)
Hi,
I'm just trying out the notifications and noticed that it changes the color of the navigation bar. I have a black nav bar and before and after the animations, the notification changes it to white (or at least almost white).
I scanned though the docs but couldn't find anything related to that. Apologies if it's already been brought up.
Thanks.
As the "Resolution Center" mentioned:
Apps must comply with all terms and conditions explained in the Apple iOS Human Interface Guidelines
We noticed your app does not comply with the Apple iOS Human Interface Guidelines.Specifically, the app sends message that overlays the status bar. We've attached screenshot for your reference.
Adding a notice about that in the markdown may save times for other developers.
I've run into an issue displaying notifications when view controller-based status bar appearance is enabled, showing a notification when a view controller is displayed and the status bar is hidden. This results in the navigation controller being temporarily pushed down when the notification is displayed.
I've resolved this by implementing prefersStatusBarHidden
in CWViewController
as follows..
- (BOOL)prefersStatusBarHidden
{
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
return !(statusBarHeight > 0);
}
This prevents the status bar from being temporarily displayed when CWViewController
is added as the root view controller of the notification window and returns false in the default implementation of prefersStatusBarHidden
.
Just wondering why this isn't a singleton (with Swift)? I know they are frowned upon most of the time. It just seems easier than to initiate a bunch of times
I get an error on latest pod, on line 111 CWStatusBarNotification.m (return _preferredStatusBarStyle) it says "undeclared identifier _preferredStatusBarStyle"
i have rejected by apple because checking version
Instead of immediately showing a notification, I should add one to a queue. This would provide better handling for multiple notifications received rapidly.
Please let me know if you'd be open to a pull request for this.
My Crashlytics has picked up a leak in the code affects iOS 8 and crashes at CWStatusBarNotification.m > updateStatusBarFrame selector function.
Any chance you could assist on how to resolve this?
Fatal Exception: NSInvalidArgumentException
-[__NSCFString updateStatusBarFrame]: unrecognized selector sent to instance
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x256cafef exceptionPreprocess
1 libobjc.A.dylib 0x33d6ec8b objc_exception_throw
2 CoreFoundation 0x256d0409 __methodDescriptionForSelector
3 CoreFoundation 0x256ce327 __forwarding
4 CoreFoundation 0x255fde78 _CF_forwarding_prep_0
5 CoreFoundation 0x25682e09 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER
6 CoreFoundation 0x255dd515 _CFXNotificationPost
7 Foundation 0x2633f749 -[NSNotificationCenter postNotificationName:object:userInfo:]
8 UIKit 0x28dcd18d -[UIApplication _notifyWillChangeStatusBarFrame:]
9 UIKit 0x28dccd8d -[UIApplication statusBar:willAnimateFromHeight:toHeight:duration:animation:]
10 UIKit 0x28db0d7f -[UIStatusBar _requestStyleAttributes:animationParameters:]
11 UIKit 0x28dafb93 -[UIStatusBar requestStyle:animated:]
12 CoreFoundation 0x25682e09 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER
13 CoreFoundation 0x255dd515 _CFXNotificationPost
14 Foundation 0x2633f749 -[NSNotificationCenter postNotificationName:object:userInfo:]
15 Foundation 0x2634422f -[NSNotificationCenter postNotificationName:object:]
16 UIKit 0x28dc738f -[UIApplication _saveSnapshotWithName:]
17 UIKit 0x28faef77 -[UIApplication _handleApplicationDectivationWithScene:shouldForceExit:transitionContext:completion:]
18 UIKit 0x28fb62b1 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke
19 UIKit 0x28fb625d -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]
20 UIKit 0x28fab11b -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]
21 FrontBoardServices 0x2c29aa65 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_2
22 FrontBoardServices 0x2c2a9ec9 __31-[FBSSerialQueue performAsync:]_block_invoke_2
23 CoreFoundation 0x25690fd5 CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK
24 CoreFoundation 0x25690299 __CFRunLoopDoBlocks
25 CoreFoundation 0x2568edd3 __CFRunLoopRun
26 CoreFoundation 0x255db201 CFRunLoopRunSpecific
27 CoreFoundation 0x255db013 CFRunLoopRunInMode
28 GraphicsServices 0x2d0ac201 GSEventRunModal
29 UIKit 0x28da7a09 UIApplicationMain
30 Social Dummy 0x00025627 main (main.m:16)
31 libdyld.dylib 0x34320aaf start
The current master
is not pushed to cocopods spec.
The label frame takes always the portrait mode frame, even after changing Orientation.
Is it possible to show a spinning view in the notification ?
Folder is empty when install Framework via CocoaPods.
I shouldn't copy *.swift files to use Framework, only pods (Because of project size and restrictions)
Issue introduced in this commit: c8ba3fc
Because the status bar notification is in a new UIWindow
, and the UIWindow
controls the frame of its rootViewController
, and userInteractionEnabled
must be set to YES
in order for subviews to be able to have a tap gesture recognizer, the transparent view of the rootViewController
covers the screen and prevents interaction with the rest of the app aside from the notification.
Resizing the UIWindow seems to limit compatibility with screen rotation. I have also tried creating a custom UIView that overrides the (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
method to return NO
on the view of the root view controller, but that seems to prevent interaction with the notification since the view of the root view controller overlaps with the frame of the notification.
In public func dismissNotificationWithCompletion(completion : (() -> ())?) you return and the function never completes
guard let view = self.isCustomView ? self.customView :
self.notificationLabel else {
return
}
You need the completion before return
guard let view = self.isCustomView ? self.customView :
self.notificationLabel else {
completion?()
return
}
I've just tried this out in an app I'm working on. When testing with double height status bar like when on a call, the notifications display much larger and jump around. Can this be fixed?
Thanks!
When text is too long it scrolls to the end of the string. But then doesn't scroll back to the beginning if user missed the first part of the text. Would be great if this was added.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.