开发者

How to set UILocalNotifications for daily weekly and yearly

开发者 https://www.devze.com 2023-03-29 23:32 出处:网络
I have an iPhone App in which i am using to fire UILocalnotification daily, Weekly and Yearly is there any good tutorial for that am using this code to set the notification

I have an iPhone App in which i am using to fire UILocalnotification daily, Weekly and Yearly is there any good tutorial for that am using this code to set the notification

- (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


Maybe this tutorial helps...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号