i trying implement 3d touch shortcuts app, i'm not sure how handle fact have navigation bar inside tab bar, if declare rootviewcontroller navigationbar shortcut works, when shortcut screen dismissed, have no tab bar. here how storyboard linked up, have no idea here.
i trying red.
@available(ios 9.0, *) func handleshortcutitem(shortcutitem: uiapplicationshortcutitem) -> bool { var handled = false if let shortcuttype = shortcuttype.init(rawvalue: shortcutitem.type) { let tabbarcontroller = uitabbarcontroller() let storyboard = uistoryboard(name: "main", bundle: nil) let rootcontroller = storyboard.instantiateviewcontrollerwithidentifier("maintabbar") as! uitabbarcontroller let tradesnav = storyboard.instantiateviewcontrollerwithidentifier("tradenavigation") // if self.window != nil { self.window!.rootviewcontroller = rootcontroller // } // root navigation view controller , first controller let rootnavigationviewcontroller = window!.rootviewcontroller as? uinavigationcontroller let rootviewcontroller = rootnavigationviewcontroller?.viewcontrollers.first uiviewcontroller? // pop root view controller segue can handled rootnavigationviewcontroller?.poptorootviewcontrolleranimated(true) switch shortcuttype { case .newtrade: tradesnav.performseguewithidentifier("newtrademodal", sender: nil) handled = true } } return handled }
Comments
Post a Comment