1、需要引入SSCActionOnCalendar.h和SSCActionOnCalendar.m
2、插入提醒事件的代码
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(0, 100, 320, 320)];
label.numberOfLines=0;
label.text=@"事件写入日历
当程序运行完成后,切出程序后在模拟器日历中,即可显示事件";
[self.window addSubview:label];
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
[inputFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
NSString* string = @"2015-08-13 21:28";
//开始时间
NSDate* startDate = [inputFormatter dateFromString:string];
NSString* string1 = @"2015-08-13 21:28";
//结束时间
NSDate* endDate = [inputFormatter dateFromString:string1];
//设置事件之前多长时候开始提醒
float alarmFloat = 0;
NSString *eventTitle = @"提醒主题";
NSString *location = @"提醒内容";
// NSString *locationStr = @"0987654321";
//isReminder 是否写入提醒事项
[SSCActionOnCalendar saveEventStartDate:startDate endDate:endDate alarm:alarmFloat eventTitle:eventTitle location:location];
测试环境:Xcode 6.2,iOS 6.0 以上