本文介绍了在EKEventEditViewController中初始化事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码如下
EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];
// set the addController's event store to the current event store.
addController.eventStore = self.eventStore;
// present EventsAddViewController as a modal view controller
[self presentModalViewController:addController animated:YES];
addController.editViewDelegate = self;
[addController release];
它将出现新事件ViewController。我想在EKEventEditViewController中初始化标题和注释。
It will appear new event ViewController. I want to initialize title and note in EKEventEditViewController.
推荐答案
我找到了办法。
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.startDate = event_date;
event.endDate = event_date;
event.notes=event_note;
EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];
// set the addController's event store to the current event store.
addController.eventStore = eventStore;
addController.event=event;
// present EventsAddViewController as a modal view controller
[parent presentModalViewController:addController animated:YES];
addController.editViewDelegate = self;
[addController release];
这篇关于在EKEventEditViewController中初始化事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!