This video discusses one of the most basic techniques for passing data between view controllers in an iOS application. This technique uses storing a local iVar in one class and passing it to the second class about to be displayed on the screen.
Although this is a very simple example using an NSString, it can be applied using any other type of data as well - whether it be a collection or a custom data model object.
hey man thans for the tutorial, very straight forward and easy to assimilate. I'm new to xcode and notice that the syntax that you used in this tutorial doesn't work quite well with the new xcode sdk. So, I had to make some changes in onder to get it done.
Best,
ismalakazel 2 weeks ago
@ismalakazel No problem - yeah, XCode 4.2 is different from XCode 4, although it is possible to make the app pretty much identically one might have to make minor modifications. This is especially true if someone uses storyboards which has other ways of making it possible to get the destination view controller.
Nethfel 2 weeks ago
Thank you for this video, Nethfel! However, I tried to make same thing SDK iOS 5 version and it doesn't work. I checked all connections on storyboard, typo, and etc. Do I need to add some extra codes because of "storyboard"?
katsushi11 3 weeks ago
@katsushi11 If you are using storyboards, the passing data technique is different - but only by a little. You'll want to implement: -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender. The segue object contains a reference to the destination view controller (as well as an identifier that you set in IB) to identify which view your transitioning to (should you have multiple separate views you connect to). With the destination view controller, you can then pass the data.
Nethfel 3 weeks ago
@Nethfel The technique I showed is geared for if you use nibs instead of storyboards.
Nethfel 3 weeks ago
This is a complete unit, there is no need for a part two on this one. I will be doing another one using singletons, but I haven't had the opportunity yet. I hope to soon when I have my laptop back.
Nethfel 2 months ago