I'm new to XCode/iOS and I'm trying to create a segue between two different screens (one with the letter A on it (a label) and the other with the letter B). I created two basic view controllers on the storyboard and then I added a button to one of them. I then control click and dragged from the button to the other view controller. I choose push. However, when I run it, it doesn't segue. Why not? I've heard about Navigation Controllers, but I don't want a naviagtion bar (with back for example) at the top of my screen, thus I didn't use one.
-
NavigationController are good anyway, you don't need to show the bar. It just keeps control of where you are, and has some great function. Par example, you could anytime you want go straight to the rootViewController. – Martol1ni May 15 '12 at 17:59
-
So if I put the first one in a navigation controller, will it work? – Nosrettap May 15 '12 at 17:59
-
I would think so, yes. Then it is also easy later on to push more views programatically. – Martol1ni May 15 '12 at 18:01
5 Answers
In order to utilize a push segue, your root view controller needs to be a navigation controller. The only segue you can use without a "master" controller of sorts like that, is a modal segue

- 17,654
- 5
- 72
- 110
You absolutely need a UINavigationController
if you want your push segue to work.
However, if you don't want to see the Navigation Bar, you can simply disable it in your navigation controller with the property navigationBarHidden
If you are using Xcode, this property can be unchecked in the Utilities Bar, Attribute Inspector under the name "Shows Navigation Bar"

- 2,237
- 2
- 23
- 32
You need a modal segue if you don't want to use Navigation Controller. Also you probably want to write your custom segue to control the transition between two view controller. You can refer to my post that explain how to segue from one scene to an other here:
How do you perform a customized segue (modal segue) from a UIButton in storyboard
Here is a very good tutorial on segues. You need to purchase the book/PDF to get the second part of this tutorial, but its a good resource to have if you want to do iOS 5.0 programming.
http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1

- 8,713
- 7
- 33
- 49
Try geeky Lemon video tutorial like this on storyboard basis: http://www.geekylemon.com/WEBPROTECT-xcodestoryboard. You can see them in the site registering or on you tube. I'm too pretty new to x code and i find this series of tutorials vero useful.

- 2,566
- 5
- 31
- 58