【发布时间】:2018-06-13 07:46:08
【问题描述】:
我目前正在尝试将 3D 触控添加到我的应用中。我已经实现了我的应用程序显示 UIApplicationShortcutItems,但现在我无法为它们分配操作。
这是我当前的代码:
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void)
{
let homeVC = HomeVC()
if shortcutItem.type == "com.appName.actionType1"
{
homeVC.tabBarController?.selectedIndex = 1
}
if shortcutItem.type == "com.appName.actionType2"
{
homeVC.tabBarController?.selectedIndex = 2
}
}
这样做并不难,但我遇到的问题是我的HomeVC 不是rootViewController。
有什么建议吗?我真的很感激。
【问题讨论】:
标签: swift uitabbarcontroller 3dtouch rootviewcontroller