Creating, configuring, and scheduling a local notification
来源:互联网 发布:中国移动m823软件 编辑:程序博客网 时间:2024/06/07 14:24
- (void)scheduleNotificationWithItem:(ToDoItem *)item interval:(int)minutesBefore { NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar]; NSDateComponents *dateComps = [[NSDateComponents alloc] init]; [dateComps setDay:item.day]; [dateComps setMonth:item.month]; [dateComps setYear:item.year]; [dateComps setHour:item.hour]; [dateComps setMinute:item.minute]; NSDate *itemDate = [calendar dateFromComponents:dateComps]; UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil)return; localNotif.fireDate = [itemDatedateByAddingTimeIntervalInterval:-(minutesBefore*60)]; localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"%@ in%i minutes.", nil), item.eventName, minutesBefore]; localNotif.alertAction = NSLocalizedString(@"View Details", nil); localNotif.soundName = UILocalNotificationDefaultSoundName; localNotif.applicationIconBadgeNumber = 1; NSDictionary *infoDict = [NSDictionary dictionaryWithObject:item.eventNameforKey:ToDoItemKey]; localNotif.userInfo = infoDict; [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];}
0 0
- Creating, configuring, and scheduling a local notification
- Calling sequence for creating and configuring a table view
- Creating a Winlogon Notification Package
- background and notification of local
- Local and Push Notification Programming Guide
- Local and Remote Notification Programming Guide
- Installing and Configuring a MySQL Database
- Creating a User in a Domain and Creating Organizational Units
- local notification
- local notification
- Local Notification
- Local Notification
- cordova local notification sound not working in ios and andorid
- Creating and Managing a Database with DBCA
- creating and drawing on a new UIImage
- Tutorial 2: Creating a Framework and Window
- Creating and/or Removing a Login Item
- Creating and Using a Temporary File
- NYOJ-小明的难题
- My Note on Algorithmn
- Codeforces #264 (Div. 2) C. Gargari and Bishops
- LeetCode 43 Convert Sorted List to Binary Search Tree
- 关于VTK中缺少动态链接库
- Creating, configuring, and scheduling a local notification
- 黑马程序员_集合
- NYOJ-Take it easy
- JavaEE 和 JavaWeb的区别与联系
- C语言中malloc 动态申请多维数组
- LCS
- List C++ Implementation
- NYOJ-奇数个数
- NYOJ-最大公约数