ios - Perform segue to another Navigation Controller without showing Tab Bar -
i have root tab host controller 2 navigation controller tab siblings: (1) nearby stops , (2) saved stops. each of these has view controller respectively.
i perform segue 1 of sibling view controllers navigation controller stop schedule view controller embedded in it, following requirements:
- the root
tab barshould not show @ bottom ofview controller - i need pass
stopobject view controller before performing segue
currently, performing segue way, though tab bar remains on stop schedule view controller when shouldn't.
func showstopschedule(stop: stop) { let stopschedulecontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("stopscheduleviewcontroller") as! stopscheduleviewcontroller stopschedulecontroller.stop = stop // pass data object self.navigationcontroller?.pushviewcontroller(stopschedulecontroller, animated: true) }
you can set hidden property of tab bar when stop schedule view controller displayed , unhide tab bar before view controller disappears
override func viewwillappear(animated: bool) { super.viewwillappear(animated) self.tabbarcontroller?.tabbar.hidden=true } override func viewwilldisappear(animated: bool) { super.viewwilldisappear(animated) self.tabbarcontroller?.tabbar.hidden=false } update: animate transition can use this:
class stopviewcontroller: uiviewcontroller { var barframe:cgrect? override func viewdidload() { super.viewdidload() // additional setup after loading view. } override func viewwillappear(animated: bool) { super.viewwillappear(animated) // self.tabbarcontroller?.tabbar.hidden=true if let tabbar=self.tabbarcontroller?.tabbar { self.barframe=tabbar.frame uiview.animatewithduration(0.3, animations: { () -> void in let newbarframe=cgrectmake(self.barframe!.origin.x, self.view.frame.size.height, self.barframe!.size.width, self.barframe!.size.height) tabbar.frame=newbarframe }, completion: { (bool) -> void in tabbar.hidden=true }) } } override func viewwilldisappear(animated: bool) { super.viewwilldisappear(animated) self.tabbarcontroller?.tabbar.hidden=false; if self.barframe != nil { uiview.animatewithduration(0.3, animations: { () -> void in let newbarframe=cgrectmake(self.barframe!.origin.x, self.view.frame.size.height-self.barframe!.size.height, self.view.frame.size.width, self.barframe!.size.height) self.tabbarcontroller?.tabbar.frame=newbarframe }) } } } 

Comments
Post a Comment