I am creating a new EKEventViewController with a event and display it afterwards
let ekEventViewController = EKEventViewController(nibName: nil, bundle: nil)
ekEventViewController.delegate = self
ekEventViewController.allowsEditing = true
ekEventViewController.event = event
setViewController(ekEventViewController)
In setViewController
I'm adding the new controller as a childViewController and the new controller's view as a subview. Now I would like to call the "EDIT" action immediately after presenting the EKEventViewController. I did not subclass anything, I just want to go to editing automatically using the EKEventEditingViewController
.
So far I've tried several methods related to "editing".
I also tried to invoke the editButtonItem
's Selector
, but no success...
ekEventViewController.perform(ekEventViewController.editButtonItem.action!
Is there a way to accomplish this without subclassing? I was even thinking about reflection but couldn't figure it out...
Thanks in advance!
Solution was to set the newly created EKEventEditViewController
as my existing UINavigationViewController of my desired ViewController, since EKEventEditViewController
is of type UINavigationController
itself.
let newNC = EKEventEditViewController()
self.navigationController = newNC
Afterwards, set newNC
as childViewController
of your current root UIViewController
and add its view as a subview.