为iPhone App每天创建五个不同时间的闹钟

时间:2011-01-25 04:26:52

标签: iphone xcode

如何为iPhone App每年创建五个不同时间的闹钟 ? 每天安排五个不同的时间

2 个答案:

答案 0 :(得分:0)

使用local notification

创建5个不同的本地通知并将重复单位设置为每日

参考apple documentation

答案 1 :(得分:0)

您需要设置notification.repeatInterval

喜欢以下

NSInteger index = [scheduleControl selectedSegmentIndex];
     switch (index) {
    case 1:
        notif.repeatInterval = NSMinuteCalendarUnit;
        break;
    case 2:
        notif.repeatInterval = NSHourCalendarUnit;
        break;
    case 3:
        notif.repeatInterval = NSDayCalendarUnit;
        break;
    case 4:
        notif.repeatInterval = NSWeekCalendarUnit;
        break;
    default:
        notif.repeatInterval = 0;
        break;
}

这会对你有所帮助 http://useyourloaf.com/blog/2010/9/13/repeating-an-ios-local-notification.html 谢谢, 函数naveed

相关问题