iOS技巧之Notification,BadgeView
来源:互联网 发布:数据质量管理制度 编辑:程序博客网 时间:2024/05/18 01:31
Tips:自定义badgeView需要此类库,不能使用ARC---badgeView封装类库下载 115网盘礼包码:5lb7f4o6
自定义效果
一、iOS提醒三种方式,自带的图标上的badge,alert,notification
在需要添加通知处,添加
01
UILocalNotification *notification=[[UILocalNotification alloc]init];
02
03
notification.repeatInterval=0;
//设置提醒重复的次数
04
05
notification.timeZone=[NSTimeZone defaultTimeZone];
//设置时区
06
07
//设置badge
08
notification.applicationIconBadgeNumber=14;
//设置number的值
09
notification.soundName=UILocalNotificationDefaultSoundName;
//设置通知声音
10
11
// 设置Alert
12
notification.alertAction=@
"打开"
;
13
14
notification.alertBody=@
"提醒"
;
15
16
notification.hasAction=YES;
17
18
19
[[UIApplication sharedApplication]scheduleLocalNotification:notification];
1、将下载的JSBadgeView解压缩后添加到工程中,添加QuartzCore.framework
2、假设要在页面中的button上添加一个Badge,在页面上添加一个button,创建映射
1
@property (retain, nonatomic) IBOutlet UIButton *button;
在需要添加badge处添加代码
01
//此处alignment有九种状态可设置,一般放在右上角
02
JSBadgeView *badgeView = [[JSBadgeView alloc ] initWithParentView:self.button alignment:JSBadgeViewAlignmentTopRight];
03
04
// 设置badgeView中的text值,不一定是数字
05
badgeView.badgeText = @
"12"
;
06
07
//还可设置badgeView的text字体,圆圈的颜色,阴影颜色等,参照JSBadgeView.h中的属性进行自定义
08
09
[self.button addSubview:badgeView];
10
11
[self.view sendSubviewToBack:self.button];
iOS技巧之Notification,BadgeView
1 0
- iOS技巧之Notification,BadgeView
- iOS技巧之Notification,BadgeView
- ios之Notification
- ios开发之Notification
- iOS之Notification
- Android技巧小结之新旧版本Notification
- Android技巧小结之新旧版本Notification
- Badgeview
- BadgeView
- BadgeView
- iOS之Local Notification(本土通知)
- iOS学习之——Notification补充
- iOS开发之Notification与多线程
- iOS Notification
- iOS Notification
- ios notification
- iOS--Notification
- ios notification
- wince SAPI 学习2
- Jquery 将表单序列化为Json对象.同时提交多个表单的参数
- FORM执行查询的各种方法
- Hibernate检索策略与检索方式
- 【转载于百度空间】C# WinForm中的BackgroundWorker控件的使用方法
- iOS技巧之Notification,BadgeView
- 《高性能Linux服务器构建实战》学习笔记
- java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFil
- windows 中 Eclipse 打开当前文件所在文件夹
- SecureCRT 详细使用图文教程
- Hive创建索引
- MFC Picture Control 控件不随图片伸缩的方法
- 程序员面试、算法研究、编程艺术、红黑树、数据挖掘5大系列集锦
- 限制鼠标活动