My app starts in view A, all the views have a tabbar with 4 buttons that let's you jump to A, B, C, D
what I currently have is this scenario:
if you navigate to either, A, B, C, D you go back to the stack bottom with all ones on top wiped out.
but I need it to behave like in this image, for example these navigation happened
1: A>1
2: B>3>7
3: C>2>5>6>8>7
4: D>9>1
now when I move from 1 to B, I go back to 7 which is the top of B
Question: I assume I need more than one navigation controller, right? also I put this in didFinishLaunchingWithOptions
function in appDelegate
, how to do more than one navigation controller programmatically? And what to use between A, B push or load view controller?
////////// NC
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainView = storyboard.instantiateViewControllerWithIdentifier("selectLocation") as! selectLocation // 1 Home
let searchView = storyboard.instantiateViewControllerWithIdentifier("2") as! Search // 1 Home
let friendsView = storyboard.instantiateViewControllerWithIdentifier("3") as! Friends // 1 Home
let meView = storyboard.instantiateViewControllerWithIdentifier("4") as! Me // 1 Home
var nav1 = UINavigationController()
nav1.viewControllers = [mainView]
nav1.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
var nav2 = UINavigationController()
nav2.viewControllers = [searchView]
nav2.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
var nav3 = UINavigationController()
nav3.viewControllers = [friendsView]
nav3.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
var nav4 = UINavigationController()
nav4.viewControllers = [meView]
nav4.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
UINavigationBar.appearance().barTintColor = UIColor(red: 176.0/255.0, green: 190.0/255.0, blue: 105.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
UINavigationBar.appearance().barStyle = UIBarStyle.BlackTranslucent
self.window!.rootViewController = nav1
self.window?.makeKeyAndVisible()
////////// NC