【问题标题】:How to set UILocalNotifications for daily weekly and yearly如何为每周和每年的每日设置 UILocalNotifications
【发布时间】:2011-08-22 09:52:52
【问题描述】:

我有一个 iPhone 应用程序,我用它来每天、每周和每年触发 UILocalnotification 是否有任何好的教程可以使用此代码设置通知

- (void)alertSelector:(NSString *)AlertTitle WithFiringTime:(NSDate *)date{
    UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];

    if (!localNotification) 
        return;
    // Set the fire date/time
    [localNotification setFireDate:date];
    [localNotification setTimeZone:[NSTimeZone defaultTimeZone]];

    // Create a payload to go along with the notification   
    NSDictionary *data = [NSDictionary dictionaryWithObject:date forKey:@"payload"];
    [localNotification setUserInfo:data];

    // Setup alert notification
    [localNotification setAlertBody:AlertTitle];
    [localNotification setAlertAction:@"View"];
    [localNotification setHasAction:YES];      

    [UILocalNotification setBadge];

//   localNotification.soundName = UILocalNotificationDefaultSoundName;
//   localNotification.soundName=@"voice.aif";

    // Schedule the notification        
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}

谢谢

【问题讨论】:

    标签: iphone objective-c ios localnotification


    【解决方案1】:

    也许this tutorial 有帮助...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多