开发者

set my own message in the alertView of calendar events

I'm current开发者_开发问答ly using the EKEvent and EKEevntUI frameworks, My Question is : is it possible to set my own message in the UIAlertView for calendar events??

Thanks,


//set event reminder
//make sure to import EventKit framework

    EKEventStore *eventDB = [[[EKEventStore alloc] init]autorelease];
    EKEvent *myEvent  = [EKEvent eventWithEventStore:eventDB];
    NSString * eventTitle = @"This is your custom title";
    myEvent.title = eventTitle;



//set event time frame (1 hour) the "initWithTimeInterval" is where we account for the users timezone by adding the correctedTime from GMT to the calendar time ( so its not off by hours when entering into calendar)
    myEvent.startDate = [[[NSDate alloc] initWithTimeInterval:correctedTimeForCalendarEvent sinceDate:destinationDate ]autorelease];
    myEvent.endDate   = [[[NSDate alloc] initWithTimeInterval:3600 sinceDate:myEvent.startDate]autorelease];
    myEvent.allDay = NO;

//set event reminders 1 day and 1 hour before
    myAlarmsArray = [[[NSMutableArray alloc] init] autorelease];
    EKAlarm *alarm1 = [EKAlarm alarmWithRelativeOffset:-3600]; // 1 Hour
    EKAlarm *alarm2 = [EKAlarm alarmWithRelativeOffset:-86400]; // 1 Day
    [myAlarmsArray addObject:alarm1];
    [myAlarmsArray addObject:alarm2];
    myEvent.alarms = myAlarmsArray;



    [myEvent setCalendar:[eventDB defaultCalendarForNewEvents]];

    NSError *err;

    [eventDB saveEvent:myEvent span:EKSpanThisEvent error:&err]; 

    if (err == noErr) {
        //no error, but do not show alert because we do that below.
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜