UILocalNotification 本地通知的用法
来源:互联网 发布:男生淘宝图片2017 编辑:程序博客网 时间:2024/05/17 07:46
本文主要介绍代码用法.理论请参见这篇文章.http://blog.csdn.net/bihailantian1988/article/details/7383197
- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view. UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem]; [btn setFrame:CGRectMake(100, 100, 100, 100)]; [btn setTitle:@"add" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(add) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeSystem]; [btn2 setFrame:CGRectMake(100, 200, 100, 100)]; [btn2 setTitle:@"look" forState:UIControlStateNormal]; [btn2 addTarget:self action:@selector(look) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn2]; UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeSystem]; [btn3 setFrame:CGRectMake(100, 300, 100, 100)]; [btn3 setTitle:@"delete" forState:UIControlStateNormal]; [btn3 addTarget:self action:@selector(clean) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn3]; }- (void)add{ NSLog(@"add点击事件"); //创建一个本地通知UILocalNotifition UILocalNotification *ln = [[UILocalNotification alloc] init]; //需要制定初始化的时间 ln.fireDate = [NSDate dateWithTimeIntervalSinceNow:5];//5秒之后 //需要制定一个弹出的内容信息 ln.alertBody = @"快起来啊,闹你妹要响了!"; //查看按钮,显示的文字 ln.alertAction = @"打开"; //打开程序,显示的启动画面 ln.alertLaunchImage = @"001.jpg"; //提醒时候播放的音频 ln.soundName = @"短信02.caf"; //应用程序图标上的数字 ln.applicationIconBadgeNumber = 2; //重复频率 ln.repeatInterval = NSCalendarUnitMinute; //将配置好的文件加到操作系统中 UIApplication *application = [UIApplication sharedApplication]; [application scheduleLocalNotification:ln]; }- (void)look{ NSLog(@"look点击事件"); UIApplication *application = [UIApplication sharedApplication]; NSArray *arr = [application scheduledLocalNotifications]; NSLog(@"%@",arr); }- (void)clean{ NSLog(@"clean点击事件"); UIApplication *application = [UIApplication sharedApplication]; [application cancelAllLocalNotifications]; }
0 0
- 本地通知UILocalNotification的用法
- UILocalNotification 本地通知的用法
- UILocalNotification本地通知的使用方法
- 本地通知 UILocalNotification的使用
- IOS本地通知(UILocalNotification)的基本使用
- UILocalNotification 本地通知的应用实例
- iOS: 本地通知(UILocalNotification )的应用
- UILocalNotification 本地通知无法删除的坑
- 本地通知UILocalNotification
- UILocalNotification 本地通知
- iOS本地通知UILocalNotification
- IOS 本地通知 UILocalNotification
- ios本地通知UILocalNotification
- 本地通知UILocalNotification
- iOS UILocalNotification本地通知
- 本地通知UILocalNotification
- iOS本地通知:UILocalNotification
- UILocalNotification本地通知介绍
- 小心使用Asp:TextBox的ReadOnly属性
- 类中的奥秘
- 2014上半年计划
- Hibernate旅程(三)Hibernate持久化对象的三个状态
- 查看ubuntu的版本号
- UILocalNotification 本地通知的用法
- flex 线形图为虚线,绘制图例(1)
- UPCC hello
- struts拦截器配置问题Unable to find interceptor class referenced by ref-name defaultStack
- Format形式下不能传入异常的解决办法
- warning: ISO C90 forbids mixed declaration
- UML之活动图
- Ruby. Vs . Python
- Java学习从菜鸟变大鸟之三 多线程中Thread 和Runnable的区别与运用