0

私はUILocalnotificationを毎日、毎週、毎年起動するために使用しているiPhoneアプリを持っていますが、このコードを使用して通知を設定するための良いチュートリアルはありますか

- (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];
}

ありがとう

4

1 に答える 1

1

多分このチュートリアルは役に立ちます...

于 2011-08-22T11:38:39.843 に答える