uitabbarcontroller - How to correctly display a tab controller in swift -


i'm making login screen app , works intented until try present main view after login(which uses tab bar controller).

the problem displays first item on tab bar. have press other buttons appear.

im using code:

//after login... var storyboard: uistoryboard = uistoryboard(name: "main", bundle: nil)  var vc: tabbarviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("maincontroller") as! tabbarviewcontroller  self.presentviewcontroller(vc, animated: true, completion: nil) 

my guess need load them @ same time, dont know...

this how did recently. loaded tabbarcontroller , login screen together, once user has logged in (or completed first screen experience) can modally dismiss controller.

func showloginview() {  let storyboard = uistoryboard(name: "main", bundle: nil) let loginviewcontroller: logintableviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("logintvc") as! logintableviewcontroller self.window?.makekeyandvisible()      var viewcontroller = storyboard.instantiateviewcontrollerwithidentifier("logintvc") as! logintableviewcontroller     let nav = uinavigationcontroller(rootviewcontroller: viewcontroller)     self.window?.rootviewcontroller?.presentviewcontroller(nav, animated: true, completion: nil) } 

for displaying tabbarcontroller , editing of of tabbaritems

let tabbarcontroller = self.window?.rootviewcontroller as? uitabbarcontroller let tabbarrootviewcontrollers: array = tabbarcontroller!.viewcontrollers! let nav = tabbarrootviewcontrollers[0] as? uinavigationcontroller 

hope helps =)


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -