- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在我的应用中,用户可以创建事件。这是通过向用户展示用于创建事件的 iOS 用户界面来实现的:
- (IBAction)addTermin:(id)sender
{
// Create an instance of EKEventEditViewController
EKEventEditViewController *addController = [[EKEventEditViewController alloc] init];
// Set addController's event store to the current event store
addController.eventStore = self.eventStore;
addController.editViewDelegate = self;
[self presentViewController:addController animated:YES completion:nil];
}
所以,我实现委托(delegate)方法:
- (void)eventEditViewController:(EKEventEditViewController *)controller
didCompleteWithAction:(EKEventEditViewAction)action
{
MRHomeViewController * __weak weakSelf = self;
// Dismiss the modal view controller
[self dismissViewControllerAnimated:YES completion:^
{
if (action != EKEventEditViewActionCanceled)
{
dispatch_async(dispatch_get_main_queue(), ^{
// Re-fetch all events happening in the next 24 hours
weakSelf.eventsList = [self fetchEvents];
// Update the UI with the above events
[weakSelf.termineTableView reloadData];
});
}
}];
}
所以,稍后我想检索用户创建的事件。我在想,在某个地方,在委托(delegate)方法中,我可以获得对新创建事件的引用吗?
或者是否有另一种方法可以稍后仅获取用户创建的事件?
最佳答案
要使其正常工作,您需要首先创建一个新的 EKEvent,保留对它的引用,并将其传递给您的 EKEventEditViewController:
self.newEvent = [EKEvent eventWithEventStore:self.eventStore];
addController.event = newEvent;
在委托(delegate)方法中,检查 EKEventEditViewActionSaved
,然后查阅 self.newEvent
以找到您需要的有关事件的信息。如果您想保留对事件的长期引用,您可以存储 eventIdentifier
或其他字段以供以后查找。
关于iOS:如何获取通过调用 EKEventEditViewController 创建的事件的标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22479903/
我正在使用 EKEventEditViewController 将事件添加到日历中,但是我需要自定义表格 View ,例如背景颜色和单元格属性。 我尝试像这样循环遍历它的 subview ,但没有成功
如何更改 EKEventEditViewController 中的默认语言,即使我手动设置 AppleLanguages 对象,它也始终是英语 最佳答案 我通过向我的应用程序 plist 添加一个 L
我正在使用 EKEventEditViewController允许将事件从我的应用程序添加到 iPhone 日历。这是目前我正在使用的代码: [self.store requestAccess
我有一个 EKEvent,我正在使用 EKEventEditViewController 在我的应用程序中添加一个日历事件。即使日期是准确的,我得到的时间也不正确。有人可以帮我弄清楚我在这里做错了什么
我在这样的助手类中展示我的EKEventEditViewController: func showAddAppointmentController(withDate date:Date) {
问题 我正在呈现一个带有一些预定义信息的 EKEventEditViewController View 。如果用户不想更改此信息,他应该能够点击添加以将事件添加到日历。 问题是,默认情况下“添加”按钮
我在我的应用程序中使用默认的 EKEventEditViewController,我想自定义它,目前它显示默认 EKEventEditViewController 中的所有字段,但我不想显示 URL
我的代码如下 EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName
我一直在尝试将 EKEventEditViewController 与 SwiftUI 一起使用。我尝试遵循开发论坛的一些建议,了解如何在带有协调器的 UIViewControllerRepresen
我有以下代码: EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibNam
当在 EKEventEditViewController 实例上编辑事件并选择另一个日历时,事件上的日历会发生变化,但对其他属性(如标题)的更改会丢失。 如果我不选择其他日历,更改将按预期保留。 这是
当我单击 EKEventEditViewController 上的“完成”按钮时,应用程序崩溃并显示“exc_bad_access”。我还使用断点来检测它,但找不到它。 gdb中没有关于crash的信
我使用 EkEventViewController 在我的应用程序中查看事件。 我的代码应该如下所示: func tableView(_ tableView: UITableView, didSel
在我的应用中,用户可以创建事件。这是通过向用户展示用于创建事件的 iOS 用户界面来实现的: - (IBAction)addTermin:(id)sender { //
我试图在我的应用程序中使用 EKEventEditViewController,它具有全局色调(在此处设置: 但是,当应用程序运行时,EKEventEditViewController 的导航按钮是灰
我正在使用以下代码创建一个事件,并显示一个弹出窗口要求用户保存该事件: EKEventStore *eventStore = [[EKEventStore alloc] init]; EKCalend
我正在尝试使用 EKEventEditViewController 添加日历事件。我已经使用 EKEventStore、EKEvent 及其 editViewDelegate 正确设置了 EKEven
以下是我添加日历事件的代码。我想发送 EKEventEditViewController 的背景图像。我找到了这段代码 UITableView *eventTableView = [[editCont
一个由两部分组成的问题:使用 SDK 的 View Controller 添加事件是可行的,但我希望将其默认设置为 Alert = "At time of event"或任何其他可用选项;我怎么做?。
我正在创建一个带有事件的新 EKEventViewController 并在之后显示它 let ekEventViewController = EKEventViewController(nibNa
我是一名优秀的程序员,十分优秀!