0

如何创建特定类型的日历?所有使用 + calendarWithEventStore: 创建的日历都是使用 Local 类型创建的:

EKEventStore *store = [[EKEventStore alloc] init];
EKCalendar *cal = [EKCalendar calendarWithEventStore:store];
4

2 回答 2

2

您可以枚举可用类型并提取您想要的类型。

EKCalendar* cal = [EKCalendar calendarWithEventStore: self.eventStore];

EKSource* sourceForType = nil;

for (EKSource* src in self.eventStore.sources)
{
    if (src.sourceType == calType)
    {
        sourceForType = src;
    }
}

cal.source = sourceForType;
于 2011-11-27T04:32:23.147 回答
1

不要忘记放置保存日历语句以创建您的日历。
   –saveCalendar:commit:error:
用于将日历保存到数据库的 EKEventStore 属性。

快乐编码,阿伦

于 2012-02-10T13:54:20.403 回答