1
我想在swift 2中第一次在xcode 7.3.1中實現3D Touch。我在info.plist中插入信息,直到這裏工作,你可以從代碼中看到打開視圖的作品,問題是我沒有查看TabBar ...所以我決定改變一切,打開tab控制器,然後從那裏移動selectindex = 2的部分類型,但不知道該怎麼辦...選擇索引函數AppDelegate與工作,有人可以幫助我?AppDelegate Touch3D Xcode - TabBar
這是我的AppDelegate代碼來管理3D觸摸
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或UINavgitaionController? –
這是TabController,這實際上是錯誤的......謝謝,現在工作 – mfiore