JDStatusBarNotification——状态栏顶部显示通知,iOS 7风格。支持 iOS 6和iOS 7

JDStatusBarNotification——状态栏顶部显示通知,iOS 7风格。支持 iOS 6和iOS 7   (在iOS代码库中浏览本帖)

管理提醒:本帖被 ccsupport 执行加亮操作(2013-11-07)
在状态栏顶部显示通知。可以自定义颜色字体以及动画。支持进度显示以及显示状态指示器。支持iOS 7以及iOS 6。


  


安装
通过CocoaPods

pod 'JDStatusBarNotification'

手动安装
1.将JDStatusBarNotification/JDStatusBarNotification拖到工程中
2.添加#include "JDStatusBarNotification.h"

用法
JDStatusBarNotification是单利模式。不需要初始化,只需要使用以下的类方法:

显示一条通知
?
1
2
3
+ (UIView*)showWithStatus:( NSString *)status;
+ (UIView*)showWithStatus:( NSString *)status
              dismissAfter:( NSTimeInterval )timeInterval;


返回的值是通知视图。你可以忽略它。如果你需要进一步自定义的话,请继续看下去。

让通知消失
?
1
2
+ ( void )dismiss;
+ ( void )dismissAfter:( NSTimeInterval )delay;


显示进度


+ (void)showProgress:(CGFloat)progress;

显示活动



?
1
2
+ ( void )showActivityIndicator:( BOOL )show
                indicatorStyle:(UIActivityIndicatorViewStyle)style;


选择不同风格的通知

可选的风格有:JDStatusBarStyleDefault, JDStatusBarStyleDark, JDStatusBarStyleError, JDStatusBarStyleWarning以及 JDStatusBarStyleSuccess。

?
1
2
3
4
5
6
+ (UIView*)showWithStatus:( NSString *)status
                 styleName:( NSString *)styleName;
 
+ (UIView*)showWithStatus:( NSString *)status
              dismissAfter:( NSTimeInterval )timeInterval
                 styleName:( NSString *)styleName;


使用这些定制的风格,你可以使用identifier,在addStyleNamed:prepare:中指定即可。见下面的定制化。

定制化
?
1
2
3
4
+ ( void )setDefaultStyle:(JDPrepareStyleBlock)prepareBlock;
 
+ ( NSString *)addStyleNamed:( NSString *)identifier
                    prepare:(JDPrepareStyleBlock)prepareBlock;



prepareBlock提供了默认风格,你可以按照以下修改:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[JDStatusBarNotification addStyleNamed:<#identifier#>
                                prepare:^JDStatusBarStyle*(JDStatusBarStyle *style) {
                                    style.barColor = <#color#>;
                                    style.textColor = <#color#>;
                                    style.font = <#font#>;
 
                                    style.textShadow = <#shadow#>;
                                    style.animationType = <#type#>;
 
                                    style.progressBarColor = <#color#>;
                                    style.progressBarHeight = <#height#>;
 
                                    return style;
                                }];


JDStatusBarNotification-master.zip (154 K) 下载次数:135
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值