Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

at0m87

macrumors newbie
Original poster
Mar 2, 2012
17
0
In my XIB Sample code, the file owner is TrainViewController and WritingViewController is added into the XIB as shown in the picture below. and the IBOUTLET "Sign" from TrainViewController is connected to WritingViewController. Note: i annotated wrongly on the picture should be TrainViewController instead of TrainingViewController.

XIB.png


So in my Storyboard which i am trying to replicate the same code, i created two view controller scene which is TrainViewController as well as WritingViewController. I am unable to link the IBOUTLET "Sign" to WritingViewController as i believe they are not "link" like in the XIB sample code where the WritingViewController is in the same XIB as the TrainViewController.

Storyboard.png


what should i do?
 
question

In storyboard, are you trying to connect a UI object in one view controller (scene) to another view controller (scene) using an outlet? If so, I think you might need to look into creating a segue instead.
 
Last edited:
In storyboard, are you trying to connect a UI object in one view controller (scene) to another view controller (scene) using an outlet? If so, I think you might need to look into creating a segue instead.

in the XIB, there is a trainViewController which declared "IBOutlet writingViewController *sign" and this IBOutlet is connected to the writingViewController view controller in the same XIB.

What i think it is actually doing is to create a link between the two controllers.

in parts of the codes of the trainViewController.m
Code:
[sign.signArray removeAllObjects];
sign.drawImage.image=nil;
sign.writeTimer=nil;

signArray, drawImage and writeTimer are all declared in the writingViewController.h

to also note that UIImageView *drawImage is declared in writingViewController.h but it is physically on the the trainViewController's view controller.

how should i achieve this same concept in the storyboard method. i know i can't connect the IBOutlet from trainViewController to writingViewController. segue? how should i do that?
 
I'm trying to learn this stuff too.

Segues are what define the transitions between view controllers (or scenes). You already have a couple of segues in your app already. Visually, they are represented by arrows between your scenes in the storyboard canvas.

You create segues in storyboard by control-dragging from a UI object or a view controller to another view controller. Then in the pop-up that appears, you choose the type of segue. For a navigation hierarchy, for example, you would choose a push segue.

As far as the outlet business goes, don't declare sign as an outlet; instead just declare it as a regular property:
@property (strong, nonatomic) writingViewController *sign;

How is the train view controller related to the rest of your app? Is the train view controller already a part of a navigation hierarchy? And how do you want the train view controller to present the writing view controller?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.