A Simple, easily customizable, lightweight notification system for iOS Apps
##Installation
Since EKNotifView is available a Pod you can add it to your project simply by adding the following line to the bottom of your Podfile
There was an issue with updating CocoaPods to version 0.0.2. That's why its not available as a pod yet. I'll fix that later.
pod 'EKNotifView', '~> 0.0.1'
##Usage
To create an EKNotifiView you need to create the notification, give it a view to appear in, a direction to slide in from (up or down), a text style (title or subtitle) a view type (loading,success,failure or info), a title, and tell it to show, here's what the code would look like
1. EKNotifView *note = [[EKNotifView alloc] initWithNotifViewType:aType notifPosition:aPosition notifTextStyle:aTextStyle andParentView:aView];
2. [note changeTitleOfLabel:aLabelType to:theTitleString];
3. [note show];
Ok I know that's alot, I'm woking on v0.0.3 which will feature a much shorter init method and more semantic setter methods. I hope to release it soon but I don't want to give any time frames yet (It shouldn't be long though)
TL;DR of the above if you wait a bit for v0.0.3 then it'll be simpler to use EKNotifView
Note: the line #2 is necessary because by default both the notification title
##View Types (for use in the init method an customization methods)
Type | Description |
---|---|
EKNotifViewTypeLoading |
Loading Style
By default a black with small,white activity indicator on the left and the title on the right By default doesn't allow tap to dismiss can only hide by calling [note hide];
|
EKNotifViewTypeSuccess |
Success Style
By default a green notification with a white check icon on the left and a title on the right By default allows tap to dismiss |
EKNotifViewTypeFailure |
Failure Style
By default a red notification with a white "x" icon on the left and a title on the right By default allows tap to dismiss |
EKNotifViewTypeInfo |
Info Style
By default a black notification with no icon on the left and a title covering the entire width of the notification By default allows tap to dismiss |
##View Positions (for use in the init method)
Type | Description |
---|---|
EKNotifViewPositionTop | View will slide down from bottom |
EKNotifViewPositionBottom | View will slide up from the bottom |
##Text Styles (for use in the init method)
Type | Description |
---|---|
EKNotifViewTextStyleTitle | Show only one vertically centered and **bolded** title |
EKNotifViewTextStyleSubtitle | Show a title on top of the notification, **bolded** and on the bottom show a notification subtitle |
##Label Types (for use in the init method an customization methods and changing the initial notification title)
Type | Description |
---|---|
EKNotifViewLabelTypeTitle | The passed text will be used as the text of the title of notification only |
EKNotifViewLabelTypeSubtitle | The passed text will be used as the text of the subtitle of notification only |
EKNotifViewLabelTypeAll | The passed text will be used as the text of both the title and subtitle of the notification |
After creating the notification via init
we need to specify the text for title of the notification and the subtitle of the notificaiton (if you're using EKNotifViewTextStyleTitle then you don't have to worry about the subtitle)
Here's we'd set the title of the notification
[note changeTitleOfLabelType:EKNotifViewLabelTypeTitle to:@"World successfully destroyed!"];
And here's how we'd set the subtitle of the notification
[note changeTitleOfLabelType:EKNotifViewLabelTypeSubtitle to:@"World successfully destroyed!"];
And to change the text of the title and subtitle to the same thing here's how it would look
[note changeTitleOfLabelType:EKNotifViewLabelTypeAll to:@"World successfully destroyed!"];
##Custmomization ###Change notification background color You customize the background of notification of a certain view type by calling
[note changeBackgroundColorToColor:someColor forViewType:aViewType];
Note: to use an image for the background color use the +imageWithPatternImage:
method of UIColor
###Change font of title and subtitle of notificaiton
[note changeFontOfLabel:aLabelType to:aUIFontObject];
Lastly,
Ok I know that's alot, I'm woking on v0.0.3 which will feature a much shorter init method and more semantic setter methods. I hope to release it soon but I don't want to give any time frames yet (It shouldn't be long though)
TL;DR of the above if you wait a bit for v0.0.3 then it'll be simpler to use EKNotifView
#Dat's all folks!