uitabbarcontroller - how to close a tabbar swift -


i have login view controller on correct login open tabbar controller following method:

self.dismissviewcontrolleranimated(true, completion: { self.loadhomescreen()})  func loadhomescreen()     {         emailfield.text = ""         passwordfield.text = ""          self.presentviewcontroller(uistoryboard.tabbarcontroller()!, animated: true, completion: nil)     }   private extension uistoryboard {         class func mainstoryboard() -> uistoryboard { return uistoryboard(name: "main", bundle: nsbundle.mainbundle()) }          class func tabbarcontroller() -> uitabbarcontroller? {             return mainstoryboard().instantiateviewcontrollerwithidentifier("tabbarcontrollerid") as? uitabbarcontroller         }     } 

i think login view controller still in background? have logout button rightbarbutton item on each navbar in tabgroup. want able close tabbar on button press. how can achieve this. can't find examples. using pop command?

update:

@ibaction func trylogout(sender: uibarbuttonitem) {         self.dismissviewcontrolleranimated(true, completion: nil)         let storyboard = uistoryboard(name: "main", bundle: nil)         let vc = storyboard.instantiateviewcontrollerwithidentifier("login") as! uiviewcontroller         self.presentviewcontroller(vc, animated: true, completion: nil)     } 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -