【1】导入工程
pod ‘JDStatusBarNotification’
【2】使用
【2.1】声明
#import <JDStatusBarNotification/JDStatusBarNotification.h>
【2.2】开启提示
[JDStatusBarNotification showWithStatus:@"驯鹿司机端正在获取您的配送轨迹" dismissAfter:3.0 styleName:JDStatusBarStyleWarning];
自带style
NSString *const JDStatusBarStyleError = @"JDStatusBarStyleError";
NSString *const JDStatusBarStyleWarning = @"JDStatusBarStyleWarning";
NSString *const JDStatusBarStyleSuccess = @"JDStatusBarStyleSuccess";
NSString *const JDStatusBarStyleMatrix = @"JDStatusBarStyleMatrix";
NSString *const JDStatusBarStyleDefault = @"JDStatusBarStyleDefault";
NSString *const JDStatusBarStyleDark = @"JDStatusBarStyleDark";
【2.3】可以关闭提示
//界面即将消失时
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[JDStatusBarNotification dismiss];
}
【3】自定义
// JDStatusBarStyle.m
// JDStatusBarStyleWarning(20171115 lonhui 自定义改为蓝色背景,白色字)
else if ([styleName isEqualToString:JDStatusBarStyleWarning]) {
//style.barColor = [UIColor colorWithRed:0.900 green:0.734 blue:0.034 alpha:1.000];
//style.textColor = [UIColor darkGrayColor];
style.barColor = [UIColor colorWithRed:0.200 green:0.400 blue:1.000 alpha:0.700];
style.textColor = [UIColor whiteColor];
style.progressBarColor = style.textColor;
return style;
}