我在我的应用程序中创建日历事件时遇到问题,我有一个集合视图,当您单击其中一个时,视图控制器弹出的日期没有我通过代码传递的名称或日期。
以下是代码:
EKEventStore *eventStore = [[EKEventStore alloc] init];
if([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
//This code will run when uses has made his/her choice
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
[event setTitle:theTitle];
event.startDate = date;
event.endDate = date;
EKEventEditViewController *controller = [[EKEventEditViewController alloc] init];
controller.navigationBar.backgroundColor = [UIColor blackColor];
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
NSLog(@"err %@", err);
controller.eventStore = eventStore;
controller.editViewDelegate = self;
[self presentViewController:controller animated:YES completion:nil];
}
代码在中
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
EKEventStore
是否有特殊方法来设置日期或标题?