本地通知UILocalNotification
来源:互联网 发布:淘宝众筹推广 编辑:程序博客网 时间:2024/05/05 02:10
转载至:http://www.cnblogs.com/bandy/archive/2012/03/29/2423555.html
//发送通知
UILocalNotification *notification=[[UILocalNotification alloc] init];
if (notification!=nil) {
NSDate *now=[NSDate new];
notification.fireDate=[now dateByAddingTimeInterval:10];//10秒后通知
notification.repeatInterval=0;//循环次数,kCFCalendarUnitWeekday一周一次
notification.timeZone=[NSTimeZone defaultTimeZone];
notification.applicationIconBadgeNumber=1; //应用的红色数字
notification.soundName= UILocalNotificationDefaultSoundName;//声音,可以换成alarm.soundName = @"myMusic.caf"
//去掉下面2行就不会弹出提示框
notification.alertBody=@"通知内容";//提示信息 弹出提示框
notification.alertAction = @"打开"; //提示框按钮
//notification.hasAction = NO; //是否显示额外的按钮,为no时alertAction消失
// NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"someValue" forKey:@"someKey"];
//notification.userInfo = infoDict; //添加额外的信息
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
[notification release];
取消通知
// Override point for customization after application launch.
application.applicationIconBadgeNumber = 0;
// Add the view controller's view to the window and display.
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
//点击提示框的打开
application.applicationIconBadgeNumber = 0;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
//当程序还在后天运行
application.applicationIconBadgeNumber = 0;
}
0 0
- 本地通知UILocalNotification
- UILocalNotification 本地通知
- iOS本地通知UILocalNotification
- IOS 本地通知 UILocalNotification
- ios本地通知UILocalNotification
- 本地通知UILocalNotification
- iOS UILocalNotification本地通知
- 本地通知UILocalNotification
- iOS本地通知:UILocalNotification
- UILocalNotification本地通知介绍
- 本地通知UILocalNotification
- UILocalNotification 本地通知
- 本地通知UILocalNotification
- iOS本地通知:UILocalNotification
- iOS UILocalNotification本地通知
- UILocalNotification一本地通知
- iOS本地通知:UILocalNotification
- 本地通知UILocalNotification
- 图文详解-报表设计器连接oracle出现的问题及解决方法
- centos 安装配置vsftpd
- socket bind failed的解决方法
- iOS - 正则表达式判断邮箱、身份证、电话号码...是否正确
- rezor视图初步认识
- 本地通知UILocalNotification
- JDK\JRE\JVM
- 此产品的试用期已结束 (SharePoint2013)
- CRC校验汇总
- Android init.c简析
- html <head>标签中<meta>的用法
- mybatis自增主键配置
- 老罗的工匠精神是不是有唯一性
- X9BYOD最佳实践1-RAID故障监控(根据用户反馈整理)