0

I want to implement 3D touch quick actions in my app with the following code:

func createQuickActions(application: UIApplication) {
    let shortcut1 = UIMutableApplicationShortcutItem(type: NSBundle.mainBundle().bundleIdentifier!+".CrearActividad", localizedTitle: "Actividad", localizedSubtitle: nil, icon: UIApplicationShortcutIcon.init(templateImageName: "iphone-3d-touch-checkbox"), userInfo: nil)
    let shortcut2 = UIMutableApplicationShortcutItem(type: NSBundle.mainBundle().bundleIdentifier!+".CrearNota", localizedTitle: "Nota", localizedSubtitle: nil, icon: UIApplicationShortcutIcon.init(templateImageName: "iphone-3d-touch-notebook"), userInfo: nil)
    let shortcut3 = UIMutableApplicationShortcutItem(type: NSBundle.mainBundle().bundleIdentifier!+".CrearReunion", localizedTitle: "Reunión", localizedSubtitle: nil, icon: UIApplicationShortcutIcon.init(templateImageName: "iphone-3d-touch-calendar"), userInfo: nil)

    application.shortcutItems = [shortcut1,shortcut2,shortcut3]
}

Upon pressing the quick action button the respective view controller appears, but without a navigation bar (on my storyboard, all view controllers are connected via navigation controller). I have important buttons on my navigation bar, so how can I instantiate and push my view controllers with a visible navigation bar/ navigation controller?

Ces
  • 343
  • 3
  • 13

1 Answers1

1

When the application is opened through 3D touch following method in AppDelegate is called.

    func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {

    //Navigate to required viewController after instantiating new navigation controller programatically

}

Hope you are adding navigation bar buttons programmatically in your respective view controllers. If so, you can view those bar buttons when accessing through 3D Touch quick actions.

Sanu S
  • 211
  • 3
  • 9
  • 1
    Thanks for your answer, I used that method and I there I called `window?.rootViewController?.showViewController` method after I chose what ViewController to show depending on the shortcutItem selected. – Ces Aug 11 '16 at 01:38