2
votes

I am a beginner with Xcode Interface Builder, and am currently trying to create a storyboarded app with three separate views and three separate view controllers, with segues between them. I decided to use Segues because a book recommended their use for custom transitions.

I created several ViewController classes (with different names), each with its own .xib file, and already linked up outlets and actions between each xib and its corresponding ViewController properties.

Now, I am wondering how I can include all of these separate files in my MainStoryboard.storyboard, which has my central view from which I want to Segue into the two additional views.

My problem is I cannot simply drag&drop or copy&paste my separate xibs into the storyboard file. Furthermore, even if I try to duplicate the view inside the storyboard xib, the corresponding ViewController files are nowhere to be found. The book tells me, though, that I need these files inside the storyboard to be able to add a Segue via Interface Builder.

If it is possible, could you please advise how I might take the work I have already done creating the two separate xib and ViewController classes, and connect them (via segue) to the screen depicted in my main storyboard file? Thank you for your help. (I have checked other Stack Overflow articles but haven't found anything about dragging and dropping a xib+ViewController set into a storyboard.)

aside: I am using Xcode 4.6 for iOS 6 development.

2

2 Answers

4
votes

I think you are a bit confused.

If you want to use storyboards in your project, you don´t need to create separate xib files (at least for now)for the viewcontrollers you want to manage inside the storyboard.

In Xcode interface builder you simply drag a viewcontroller from the object library to the sotryboard, you can find it at the bottom of the right panel (the utility panel) .

Once you have your visual viewcontroller on the storyboard you need to asociate a UIVIewController subclass who can manage that viewcontroller. you do so by selecting the viewcontroller on the storyboard and selecting the identity inspector on the right panel (again the utility panel) then in the textbox next to the word "class" you write the name of the class that will manage that viewcontroller (if you´ve already created it).

Now you can make the connections of the viewcontroller´s subviews and YourUIViewcontrollerSubClass.h and create the properties you want to handle in code.

0
votes

You don't need xib files in story board. Because you can add view controllers directly in storyboard without xib. However you can create separate xibs as well and add it on navigation controller via code