如何使用快捷方式启动并导航到特定的视图控制器?
我在我的应用程序中使用 UINavigationController。问题是当我单击快捷方式项目时,我必须直接导航到最后一个视图控制器。在最后一个视图控制器中,我将有返回按钮来导航回以前的屏幕。这可能吗?
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: Bool -> Void) {
let handledShortCutItem = handleShortCutItem(shortcutItem)
completionHandler(handledShortCutItem)
}
func handleShortCutItem(shortcutItem: UIApplicationShortcutItem) -> Bool {
var handled = false
// Verify that the provided `shortcutItem`'s `type` is one handled by the application.
guard ShortcutIdentifier(fullType: shortcutItem.type) != nil else { return false }
guard let shortCutType = shortcutItem.type as String? else { return false }
switch (shortCutType) {
case ShortcutIdentifier.LastViewController.type:
print("Inside Agent **********")
**// Navigate to view controller**
handled = true
break
default:
break
}