Ios AppDelegate Touch3D Xcode-选项卡栏
我第一次尝试在swift 2中的xcode 7.3.1中实现3D触摸。我在info.plist中插入了这些信息,直到这里,你可以从代码中看到打开视图的效果,问题是我没有查看选项卡栏。。。所以我决定改变一切,打开tab控制器,然后从那里开始在selectindex=2的部分中键入,但不知道如何做。。。选择索引函数AppDelegate与工作,有人可以帮我吗 这是我在AppDelegate中管理3D Touch的代码Ios AppDelegate Touch3D Xcode-选项卡栏,ios,swift,xcode,touch,Ios,Swift,Xcode,Touch,我第一次尝试在swift 2中的xcode 7.3.1中实现3D触摸。我在info.plist中插入了这些信息,直到这里,你可以从代码中看到打开视图的效果,问题是我没有查看选项卡栏。。。所以我决定改变一切,打开tab控制器,然后从那里开始在selectindex=2的部分中键入,但不知道如何做。。。选择索引函数AppDelegate与工作,有人可以帮我吗 这是我在AppDelegate中管理3D Touch的代码 func application(application: UIApplicati
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: Bool -> Void) {
//questo codice verrà eseguito ogni volta che le Quick Actions verranno eseguite
if (shortcutItem.type == "com.tuu.openSearch") {
//section search THIS WORK without TabBar!!
let viewcontroller = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("searchID")
dispatch_async(dispatch_get_main_queue(), {
self.window!.rootViewController?.presentViewController(viewcontroller, animated: false, completion: nil)
})
}
if (shortcutItem.type == "com.tuu.openFavorite"){
//section tabbar favorite, self.tabBarcontroller.selectedIndex = 2 not work!!
let viewcontroller = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("favoritesID")
viewcontroller.tabBarController?.selectedIndex = 2
dispatch_async(dispatch_get_main_queue(), {
self.window!.rootViewController?.presentViewController(viewcontroller, animated: false, completion: nil)
})
}
}
解决
解决
请让我知道viewController是UIViewController还是UIAvgitaionController?这是TabController,这实际上是错误。。。谢谢,现在请让我知道viewController是UIViewController还是UIAvgitaionController?这是TabController,这实际上是错误。。。谢谢,现在可以了
if (shortcutItem.type == "com.tuu.openFavorite"){
let tabBarController = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("favoritesID") as! UITabBarController
tabBarController.selectedIndex = 2
self.window?.rootViewController = tabBarController
}