1
votes

I have two view controllers and a Navigation contoller in a storyboard. In the first view controller I have two buttons.

Both buttons segue to the second view which contains a map and opens the map with different info. They are both of the kind show.

The first button when clicked opens the map with the navigation bar at the top (it loads from the side).

The second button loads the map without the navigation bar (it loads from the bottom).

I want both buttons to load the map with the navigation bar.

I am using xcode 7.3 swift and storyboards

Also using prepare for segue

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  if(segue.identifier == "lav"){
    let DestViewController = segue.destinationViewController as! MapView
    DestViewController.type = typeLav
  }
  if(segue.identifier == "cam"){
    let DestViewController = segue.destinationViewController as! MapView
    DestViewController.type = typeCam
  }
}
1
second button probably opens new view in modal, and that's why there is no navigation bar, check again if second button segue is 'show'.tbilopavlovic
Yes both segues are of kind Show (e.g Push)JoeyA

1 Answers

3
votes

Set the segue action

  • Present Modally

    Show Up from bottom, and without navigation controller, so there is no navbar too.

  • Push

    Push the view controller to current navigation stack, so the navigation bar is shown

btw, method prepareForSegue was used to setup data transfered between view controllers;