我有一个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];
}
thankx