problame / csnotificationview Goto Github PK
View Code? Open in Web Editor NEWDrop-in, semi-translucent and blurring notification view.
License: MIT License
Drop-in, semi-translucent and blurring notification view.
License: MIT License
I have one Side Panel View controller
that contains one CenterPanel (TabBarController) and SidePanel- (ViewController)
Tab Bar controller contains two NavigationController each having one ViewController.
Is there any way to bring notification to front.
The current exclamation mark is OK but not good.
In particular, I find it too bold for iOS 7.
In addition, the exclamation mark and it's frame is are too close.
If there's anybody out there who has any talent regarding icon design and probably five minutes of time: I beg you, help us!
Once a CSNotification is shown from a UITableViewController with static cells, tableview can no longer scroll to the bottom: scrolling bounces back and hides the bottom cells (as though its content size or frame is incorrenct). Scrolling works as expected until CSNotification is first called from the view controller.
Tableviews with dynamic cells seems to work properly.
HI there,
I was using CSNotificationView in my app, now I'm working on the iPhone 6 version and I found a weird behaviour on iOS 8.1.
When the notification tries to expire (in my use case I had an error notification, so red background), what I get is a jump of the label on top of the notification view while the view moves down and up. At the end of the animation the notification view disappear as expected.
To better clarify, have a look at the debug image in which I collected all the screenshots taken from the simulator. Please note, I had the same behaviour on device.
dismissWithStyle duration hardcoded to 2 seconds. The duration parameter is not used not all. Please change it. Also provide a completion handler to dismissWithStyle method.
CSNotificationView_Private.h:34:1: Getter name mismatch between property redeclaration ('isVisible') and its original declaration ('isShowing')
Let the user show the card on request, and hide it on demand. This way, it can act like a progress Indicator.
Pods/CSNotificationView/CSNotificationView/CSNativeBlurView.h:12:31: Cannot find interface declaration for 'UIVisualEffectView', superclass of 'CSNativeBlurView'
Pods/CSNotificationView/CSNotificationView/CSNotificationView.m:13:9: In file included from Pods/CSNotificationView/CSNotificationView/CSNotificationView.m:13:
Pods/CSNotificationView/CSNotificationView/CSNativeBlurView.m:25:35: Use of undeclared identifier 'UIBlurEffect'
If the message is too long, only the first 2 lines will be shown.
Please add support two views on screen in the same time
The blur effect always has to a subview of CSNotificationView
.
Depending on the OS version, either the old layer-stealing or the new UIVisualEffectView
will be used.
The implementations should be encapsulated in a subclass. This allows adoption of other effect views such as FXBlurView later.
Requires restructuring large parts of the project.
Currently long texts gets size adjustments rather than view get adjusted. Provide a dynamic way to customize notification view height.
The currently used private imageView
must be replaced by a generic UIView symbolView
.
Then, the setter of image
must be overridden: it will generate a UIImageView on demand and set the symbolView
property.
Then, there can be an additional method for setting a UIActivityIndicatorView as symbolicView.
As documented in the discussion in #57 and #56, CSNotificationView
is displayed with the status bar offset in a container view controller.
The key point is: CSNotificationView
cannot always rely on the layout guides provided by the view controllers it is presented in. (Details in the comments on #57):
Hence, it has a method that calculates the .length
property of what would normally be the topLayoutGuide
, taking into account
UINavgiationController
has its navigation bar visible or notThis behavior breaks in Container View Controllers that are not full-screen and also in modal Form-Style View Controllers on iPad.
The main author (me) does not have the time to fix this bug properly. I would appreciate pull requests that if possible maintain backwards-compatibility.
There are crashes related to CSNotificationView being reported to me since 0.4 (commit 54ea081).
There is EXC_BAD_ACCESS KERN_PROTECTION_FAILURE
after the following to methods are called over and over again - with some UIKit stuff in between:
0 CoreFoundation 0x0000000189e749f4 -[NSArray isEqualToArray:] + 48
1 CoreFoundation 0x0000000189e749b8 -[NSArray isEqual:] + 96
2 CoreFoundation 0x0000000189e749b8 -[NSArray isEqual:] + 96
3 UIKit 0x000000018d026d20 -[UINavigationBar _setItems:transition:] + 128
4 UIKit 0x000000018d1f281c -[UINavigationController _updateNavigationBarItems:] + 160
5 UIKit 0x000000018cf80058 -[UINavigationController loadView] + 288
6 UIKit 0x000000018ceec488 -[UIViewController loadViewIfRequired] + 88
7 UIKit 0x000000018ceec3f4 -[UIViewController view] + 32
8 MYAPP 0x00000001001508c8 -[CSNotificationView hiddenFrame] (CSNotificationView.m:416)
9 MYAPP 0x000000010014f654 -[CSNotificationView observeValueForKeyPath:ofObject:change:context:] (CSNotificationView.m:237)
10 Foundation 0x000000018a9cddf4 NSKeyValueNotifyObserver + 340
11 Foundation 0x000000018a9cd924 NSKeyValueDidChange + 432
12 Foundation 0x000000018a9b6544 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 116
13 UIKit 0x000000018cf8376c -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 428
14 UIKit 0x000000018cf8355c -[UINavigationController _positionNavigationBarHidden:edge:] + 152
15 UIKit 0x000000018cf800a4 -[UINavigationController loadView] + 364
16 UIKit 0x000000018ceec488 -[UIViewController loadViewIfRequired] + 88
17 UIKit 0x000000018ceec3f4 -[UIViewController view] + 32
18 MYAPP 0x00000001001508c8 -[CSNotificationView hiddenFrame] (CSNotificationView.m:416)
19 MYAPP 0x000000010014f654 -[CSNotificationView observeValueForKeyPath:ofObject:change:context:] (CSNotificationView.m:237)
20 Foundation 0x000000018a9cddf4 NSKeyValueNotifyObserver + 340
21 Foundation 0x000000018a9cd924 NSKeyValueDidChange + 432
22 Foundation 0x000000018a9b6544 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 116
23 UIKit 0x000000018cf8376c -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 428
24 UIKit 0x000000018cf8355c -[UINavigationController _positionNavigationBarHidden:edge:] + 152
25 UIKit 0x000000018cf800a4 -[UINavigationController loadView] + 364
26 UIKit 0x000000018ceec488 -[UIViewController loadViewIfRequired] + 88
27 UIKit 0x000000018ceec3f4 -[UIViewController view] + 32
...
These crashes appear mostly when the app logic wants to present a CSNotificationView but the app's views etc. are not fully initialized yet.
I think that's why we see such a repeating schema of -[UIViewController view]
being called.
In addition, this has something to to with KVO (hence: the calls to -[CSNotificationView observeValueForKeyPath:ofObject:change:context:]
)
Do you have any idea what could be behind all this?
When notification is tapped, CSNotificationView should run a block of code or delegate method.
For something similar, check here:
https://github.com/alobi/ALAlertBanner/blob/master/ALAlertBanner/ALAlertBanner.h
From the activity example:
CSNotificationView* note = (...);
note.showingActivity = YES;
[note setVisible:YES animated:YES completion:nil];
(...)
[note dismissWithStyle:CSNotificationViewStyleSuccess message:@"Success!"
duration:kCSNotificationViewDefaultShowDuration animated:YES];
If I created the view with _progressNotification = [[CSNotificationView alloc] initWithParentViewController:_topVC];
I am unable to set the textLabel.
Implement the currently used layer-stealing as a subclass as described in #37
It's possible to display CSNotificationView on top of UINavigationBar? Sometimes it's not very good to hide content under nav bar.
I got this from an arabic developer: https://twitter.com/Doss_ry/status/388929360591601665
Is there any API for right-to-left text or does UILabel handle appropriately flagged strings automatically?
Would be great!
UPD:
currently I do that using
[[note.blurView.subviews firstObject] setBackgroundColor:[UIColor redColor]];
Create separate instance methods for showing and dismissing the view.
These methods should have a paramter animated
like many other UIKit methods have.
There should be easy options to determine whether the view is currently animating or not --> animationState
property.
Create podspec and submit project to CocoaPods.
Semantic issue
.../CSNotificationView/CSNotificationView.m:385: 100 : 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
CGFloat top = MIN([UIApplication sharedApplication].statusBarFrame.size.height, [UIApplication sharedApplication].statusBarFrame.size.width);
In the demo, the toolbar will lose tint color when going back from detain view, and will never be applied tint after that... still investigating how that might have happened
Hi, I have notice there's some weird animation behaviour going on with my notification after upgrading to XCode6. What it basically do is that it will kind of move downwards quickly before dismissed.
Not sure what caused this. I use the basic code to call it.
[CSNotificationView showInViewController:[self navigationController]
style:CSNotificationViewStyleSuccess message:@"Item addded to your cart."];
Did some attempts to support ios 6:
//Change UIToolBar Appearance
[UIToolbar appearance] setBackgroundImage: [clear image]];
//Textlabel
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
UIFontDescriptor* textLabelFontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleBody];
_textLabel.font = [UIFont fontWithDescriptor:textLabelFontDescriptor size:17.0f];
}
_textLabel.backgroundColor = [UIColor clearColor];
//setTintColor
if (SYSTEM_VERSION_LESS_THAN(@"7.0")) {
[self.toolbar setBackgroundColor:tintColor];
}else{
[self.toolbar setBarTintColor:tintColor];
}
}
//visibleFrame
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
displayFrame = CGRectMake(0, 0, CGRectGetWidth(viewController.view.frame),
kCGNotificationViewHeight + viewController.topLayoutGuide.length);
}else{
displayFrame = CGRectMake(0, 0, CGRectGetWidth(viewController.view.frame),
kCGNotificationViewHeight + 0);
}
//hiddenFrame
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
offscreenFrame = CGRectMake(0, -kCGNotificationViewHeight - viewController.topLayoutGuide.length,
CGRectGetWidth(viewController.view.frame),
kCGNotificationViewHeight + viewController.topLayoutGuide.length);
}else{
offscreenFrame = CGRectMake(0, -kCGNotificationViewHeight,
CGRectGetWidth(viewController.view.frame),
kCGNotificationViewHeight);
}
Everything seems to be working fine.
Is there any plan for extending compatibility with iOS 6? such as displaying a non transparent notification in iOS 6?
Hi,
CSNotificationView does not support BitCode on XCode 7 by default using CocoaPods, so how to fix this problem?
I'm finding it awkward to customise my notification and assign a tap handler since the notificationViewWithParentViewController:...
method doesn't let me customise the font and then the textLabel
is private.
Blur colors need to be adjusted to an alpha
< 1, do this internally
Either the view needs to have autolayout constraints added or it needs to manually adjust its layout when the device is rotated. It sorta half-works in that it appears in the correct position after rotation, however its width (and I think also height) is not adjusting.
When used in a NavigationController-based views, if the navigation bar is hidden, the notification view is present over the status bar, and this may caused to be rejected by apple.
If I present a UINavigationViewController, show a CSNotificationView view within this modal view controller and dismiss the modal view controller during the CSNotificationView's presentation time, then I receive the following error in iOS 8:
Fatal Exception: NSInternalInconsistencyException
An instance 0x[...] of class UINavigationBar was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x[...]> ( <NSKeyValueObservance 0x[...]: Observer: 0x[...], Key path: bounds, Options: <New: YES, Old: NO, Prior: NO> Context: 0x[...], Property: 0x[...]> )
By the way:
The reason why a CSNotificationView might be present on dismiss is that I use CSNotificationView to show Push Notifications when the App is in the foreground. So a CSNotificationView might be added at all times.
create CocoaPods
I'm using CSNotificationView in iOS 8 and when I show an error notification in a view without UINavigationController then all looks fine when presenting the notification, but when the notification disappears there is a bug: The Background color of the notification goes down at the beginning of the animation.
Here's a screen recording taken from the Simulator with the "Slow Animations" toggle set:
https://www.dropbox.com/s/1piferr0c2hydzy/CSNotificationView%20Bug%20iOS8.mov
Is there an easy way to accomplish this? ๐
The font is always white by default. It should adjust dynamically to the color / brightness of the blurTintColor
property.
I don't know how to automatically find a nice color, but if you implement it, use KVO ;)
This should be simple and just for structure's sake. A class that adopts UIVisualEffectView
as described in #37
CSNotificationView/CSNotificationView.m:15:17: Method override for the designated initializer of the superclass '-initWithFrame:' not found
There's currently a problem with finding the right bundle when getting the images in imageForStyle
. My app crashed due to the error mentioned in the title.
I'm using XCode 6.1 GM release.
Right now, when calling showInViewController:...
a second time while the first view is still being presented, the new view moves over the old one - not so great.
My idea:
1: Queuing
One could create a queue as a static object of CSNotificationView
which holds track of all notifications to show per view controller.
Problem: If there are many notifications stacking, the delay is too long, showing the notification might confuse the user.
2: Queuing + Stacking
Given that there won't be two or three notifications showing in the same time, one could build up a stack inspired by in Apple's Passbook: New notifications appear a bit lower than the previous one and move up when the old is dismissed.
Implementing simple user interaction allowing to kick the view out earlier (--> UIKit Dynamics) might improve UX.
CSNotificationView disappears randomly
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x1f524250 h=-&- v=--& CSNotificationView:0x141d72c0.width == UIView:0x15944d40.width - 320>",
"<NSLayoutConstraint:0x1f524550 H:|-(4)-[UIActivityIndicatorView:0x1d836340] (Names: '|':CSNotificationView:0x141d72c0 )>",
"<NSLayoutConstraint:0x1f524510 H:[UIActivityIndicatorView:0x1d836340(44)]>",
"<NSLayoutConstraint:0x1f5244d0 H:[UIActivityIndicatorView:0x1d836340]-(5)-[UILabel:0x1d8364c0'Establishing...']>",
"<NSLayoutConstraint:0x1f524490 H:[UILabel:0x1d8364c0'Establishing...']-(10)-| (Names: '|':CSNotificationView:0x141d72c0 )>",
"<NSLayoutConstraint:0x1f524150 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15944d40(320)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1f5244d0 H:[UIActivityIndicatorView:0x1d836340]-(5)-[UILabel:0x1d8364c0'Establishing ...']>
Sample:
let loader = CSNotificationView(parentViewController: self,
tintColor: UIColor(red: 0, green: 0, blue: 0, alpha: 0.1),
image: nil,
message: message)
loader.showingActivity = true
loader.setVisible(true, animated: true, completion: nil)
One could make use of Dynamic Type for the textLabel
.
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.