IOS 本地通知
来源:互联网 发布:广州知伴科技有限公司 编辑:程序博客网 时间:2024/06/02 06:50
实现本地通知,多话不说,直接代码:
下面这个可以写在一个button事件中
/*------------------ 本地通知 ----------------- */ //最多64条 //初始化 UILocalNotification *localNotFication = [[UILocalNotification alloc] init]; //设置延迟5秒后 localNotFication.fireDate = [[NSDate alloc] initWithTimeIntervalSinceNow:5]; //设置通知消息 localNotFication.alertBody = @"嗨,大米,你好!"; //设置通知标记数 localNotFication.applicationIconBadgeNumber = 63; //设置通知出现时候的声音 localNotFication.soundName = UILocalNotificationDefaultSoundName; //设置动作按钮的标题 localNotFication.alertAction = @"View Details";//这里是当机子锁定后在锁定界面提示信息 //计划通知 (发送) [[UIApplication sharedApplication] scheduleLocalNotification:localNotFication]; [localNotFication release] ;
取消通知:(我写在一个方法中)
- (IBAction)button2Action:(id)sender { //取消通知 [[UIApplication sharedApplication] cancelAllLocalNotifications];// [UIApplication sharedApplication] cancelLocalNotification:]}要清除软件ICON上的通知个数的提示,则要在AppDelegate方法中实现下面这个方法
- (void)applicationDidBecomeActive:(UIApplication *)application{ application.applicationIconBadgeNumber = 0;}
如有疑问,请留言.
0 0
- iOS 本地通知 远程通知
- iOS本地通知 远程通知
- iOS本地通知&定时通知
- iOS实现本地通知
- iOS本地通知
- iOS本地通知
- iOS本地通知UILocalNotification
- IOS实现本地通知
- IOS 本地通知 UILocalNotification
- ios本地通知UILocalNotification
- iOS UILocalNotification本地通知
- iOS实现本地通知
- iOS实现本地通知
- IOS实现本地通知
- iOS-本地通知
- IOS 本地通知
- IOS本地推送通知
- iOS本地通知:UILocalNotification
- 她
- ios 通过对象找到它的类名
- ExtractStrings c++builder 字符串分解
- IOS-UIImage保存到iOS照片库和对应程序沙盒中
- ajax全局事件
- IOS 本地通知
- 关于Parent: child process exited with status 3221225477 -- Restarting.(转)
- 简单的验证码架构(1)
- 第二十五讲 实例补充
- RHEL6通过安装光盘或ISO文件制作本地yum源的方法
- session超时
- python操作文件目录
- 身份证号码规则
- Android WebView图片浏览