本地通知
来源:互联网 发布:nginx缓存配置 编辑:程序博客网 时间:2024/05/02 06:13
UILocalNotification *notification=[[UILocalNotification alloc] init];if (notification != nil) { // 基本参数设置 NSDate *now=[NSDate new];//5秒后通知notification.fireDate = [now dateByAddingTimeInterval:5];notification.repeatInterval = 0; notification.timeZone = [NSTimeZone defaultTimeZone];//应用的红色数字 notification.applicationIconBadgeNumber = 1;NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, YES); NSString *string = [NSString stringWithFormat:@"%@%@",pathArray[0],@"/Audio/UISounds/New/Calypso.caf"]; //播放音调 SystemSoundID theSoundID; AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:string], &theSoundID); AudioServicesPlaySystemSound(theSoundID);
// 提示声音
notification.soundName = string; // 弹出提示框 notification.alertBody = @"通知声音测试"; notification.alertAction = @"打开"; NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"本地通知测试声音文件" forKey:@"sound"]; notification.userInfo = infoDict; // 一定间隔后触发通知 [[UIApplication sharedApplication] scheduleLocalNotification:notification]; }
// 提示数字清零
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { //点击提示框的打开 application.applicationIconBadgeNumber = 0;}
- (void)applicationDidBecomeActive:(UIApplication *)application { //当程序还在后天运行 application.applicationIconBadgeNumber = 0;}
- 本地通知
- 本地通知。
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 本地通知
- 基于SDN-OpenFlow的网络智能控制
- 通用的自定义的下拉刷新,上拉更多,适用listView,gridView,ScrollView
- WEBService服务
- ClickHeat安装使用手册
- hdu4750(并查集)
- 本地通知
- 查看进程所占fd数和修改系统配置的方法
- HDU 1219(2013.9.21周赛B题:统计字母)
- Spring Aop开发过程中可能出现的异常(通过这些异常可以知道需要什么Jar包)
- myeclipse报An error has occurred,See error log for more details. java.lang.NullPointerException错误
- Linux中Kill进程的N种方法
- Sql Server中查看数据表空间使用情况
- Ecommerce Tracking - Web Tracking (ga.js)谷歌GA埋点web日志跟踪统计实例
- ubuntu 下的U盘挂载与卸载