

Installation
Cocoapods:
pod 'JDStatusBarNotification'(For infos on cocoapods, have a look at the cocoapods website)
Manually:
- Drag the 
JDStatusBarNotification/JDStatusBarNotificationfolder into your project. - Add 
#include "JDStatusBarNotification.h", where you want to use it 
Usage
JDStatusBarNotification is a singleton. You don't need to initialize it anywhere. Just use the following class methods:Showing a notification
+ (JDStatusBarView*)showWithStatus:(NSString *)status;
+ (JDStatusBarView*)showWithStatus:(NSString *)status
                      dismissAfter:(NSTimeInterval)timeInterval;
The return value will be the notification view. You can just ignore 
it, but if you need further customization, this is where you can access 
the view.Dismissing a notification
+ (void)dismiss;
+ (void)dismissAfter:(NSTimeInterval)delay;
Showing progress

+ (void)showProgress:(CGFloat)progress;  // Range: 0.0 - 1.0
Showing activity

+ (void)showActivityIndicator:(BOOL)show
               indicatorStyle:(UIActivityIndicatorViewStyle)style;
Showing a notification with alternative styles
Included styles:
Use them with the following methods:
+ (JDStatusBarView*)showWithStatus:(NSString *)status
                         styleName:(NSString*)styleName;
+ (JDStatusBarView*)showWithStatus:(NSString *)status
                      dismissAfter:(NSTimeInterval)timeInterval
                         styleName:(NSString*)styleName;
To present a notification using a custom style, use the identifier you specified in addStyleNamed:prepare:. See Customization below.Beware
@goelv informed me, that his app got rejected because of a status bar overlay (for violating 10.1/10.3). So don't overuse it. Although this is the first case I heard of. I even shipped an App myself using this class. It had no problems.Customization
+ (void)setDefaultStyle:(JDPrepareStyleBlock)prepareBlock;
+ (NSString*)addStyleNamed:(NSString*)identifier
                   prepare:(JDPrepareStyleBlock)prepareBlock;
The prepareBlock gives you a copy of the default style, which can be modified as you like:[JDStatusBarNotification addStyleNamed:<#identifier#>
                               prepare:^JDStatusBarStyle*(JDStatusBarStyle *style) {
                                   // main properties
                                   style.barColor = <#color#>;
                                   style.textColor = <#color#>;
                                   style.font = <#font#>;
                                   // advanced properties
                                   style.animationType = <#type#>;
                                   style.textShadow = <#shadow#>;
                                   style.textVerticalPositionAdjustment = <#adjustment#>;
                                   // progress bar
                                   style.progressBarColor = <#color#>;
                                   style.progressBarHeight = <#height#>;
                                   style.progressBarPosition = <#position#>;
                                   return style;
                               }];
Animation Types
JDStatusBarAnimationTypeNoneJDStatusBarAnimationTypeMoveJDStatusBarAnimationTypeBounceJDStatusBarAnimationTypeFade
Progress Bar Positions
JDStatusBarProgressBarPositionBottomJDStatusBarProgressBarPositionCenterJDStatusBarProgressBarPositionTopJDStatusBarProgressBarPositionBelowJDStatusBarProgressBarPositionNavBar
No comments:
Post a Comment