How to Properly Use Storyboards in iOS Apps
Using storyboards in iOS isn’t all that new in the world of iOS, but for the beginning developer, the process of working with them beyond the basics presents a number of challenges. Many of the tutorials and help documents that would be helpful talk about .xib files and although they are similar, not everything carries over directly. This article will cover the basics of how to work with the UIStoryboard object.
First, you will need to set up your project as a Storyboard project. The Single View application is the easiest to begin with, unless you now you’ll need one of the features the other types offers. The default will generate a storyboard, as long as you are using the most recent version of Xcode.
The next thing you should know is that you will create “scenes” by adding View Controllers to the storyboard. You can add in buttons, views, images, labels, and any other layout elements you want to each scene. To make simple navigation between scenes, you will click on the button and option-drag to the scene you want the button to navigate to. Interface Builder will automatically create a transition based on the option you select. Push is by far the most common option to choose. But you may need modals or popovers, depending on your project
The important thing to remember as you start making programmatic changes to the project, is that each scene will need its own View Controller .h and .m files. To add these to the project, hit Command+N and name them according to the view controller. Then make sure that the scene is named accordingly. It is really important to make sure that you have a view controller for each view that you have. If you don’t and you need to pass data between views, you will quickly run into conflicts.
So the moral of the story is that with storyboards in iOS, you need to make sure that you aren’t doing things all that much differently than you would with .xib’s. The only big difference is the segues and transitions between views.