1

我遵循了许多教程并查看了文档,并认为我有正确的代码,但它仍然不想再次出现。任何想法将不胜感激。我的代码如下。谢谢。

 EKRecurrenceEnd *endRecurrence = [EKRecurrenceEnd recurrenceEndWithOccurrenceCount:14];

    EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] initRecurrenceWithFrequency:EKRecurrenceFrequencyWeekly interval:1 end:endRecurrence];

    NSMutableArray *rules = [[NSMutableArray alloc] init];

    [rules arrayByAddingObject:rule];

    event.recurrenceRules = rules; 
4

1 回答 1

4

我相信你这样做的方式是这样的:(我添加了一个案例,如果你想摆脱任何已经存在的规则)

NSArray* rulesArray = [event recurrenceRules];

for (EKRecurrenceRule* rule in rulesArray) [event removeRecurrenceRule:rule];

EKRecurrenceEnd *endRecurrence = [EKRecurrenceEnd recurrenceEndWithOccurrenceCount:14];

    EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] initRecurrenceWithFrequency:EKRecurrenceFrequencyWeekly interval:1 end:endRecurrence];

    [event addRecurrenceRule:rule]; 

    [rule release];

然后如果需要,只需添加另一个

于 2012-04-26T00:53:56.157 回答