This is the second part of the UINavigationController tutorial. In this part I illustrate sharing data between multiple xib files.

** Danger I now disagree with this tutorial. Remember, like most of y'all I didn't do extensive Objective-C before the iPhone (didn't pay). I took shortcuts too, now I don't, I believe you have to do this just like you would using C++, Java, or any other object-oriented language. Sticking data classes in the Application Delegate is not the way to go. Create an object model and pass it around like a God fearing developer worth his or her salt is supposed to do! BTW: THIS TUTORIAL IS OUTDATED
  • Sean Hankins 10 months ago
    So, if it is not recommended to share data between xibs, as you demonstrate, what is the recommended method of passing data (short of storing all the little bits in sqlite tables)?
  • James A. Brannan 6 months ago
    I disagree sharing data even the way presented here. Instead, I have come to the conclusion the only good way is the way presented by Stanford's class. It's how I would do it using any other programming language, so it's how I would do it here. Essentially, have a data object, maybe an aggregate object, and you pass it from class to class. Pain in the butt, but shouldn't be sticking stuff in the application delegate.
  •  
  • brandon steili 10 months ago
    I've been keep track of data though the appDelegate.
  •  
  • VMan 10 months ago
    James, you are a true asset to the development community! There are so many aspects of development with IB that is not adequately covered by any current books or Apple documentation. Thank you!!
  •  
  • Patrick Santana 8 months ago
    It is a good point of view. What you did was wrong if we talk about MVC patterns, but you explained why.

    I think for small application, that would not be a big impact; and definitely I would use without worry about it.

    Another time, great tutorial.

    Thank you
  •  
  • Matias Pequeno 6 months ago
    You got it right, James. As a C++ as well, I find very annoying ObjC doesn't crash when using unallocated objects, its incredibly stupid.

    And they say it's "true object oriented":

    * If you have a Java/C++ car engine without a cooling system, the engine will blow away because there is no cooling system.

    * If you have an ObjC car engine without a cooling system, it will start... But it may do nothing... Perhaps! Who knows...? ...Does anybody?

    If we take into account that object oriented programming is a take into trying to make programming more "human readable"... What is the most human readable behavior you would expect from a car without a cooling system?

    Objective-C is full of non-sense.
  •  
  • Charlie Seligman 3 months ago
    Hi James,

    Thanks for this tutorial. Like you I have been looking at the Stanford lectures (no 7 in particular). I was suprised when Evan skipped over what I felt is one of the most fundamental points of Nav controllers (passing data up and down the stack) - especially given his brilliant teaching style for everything else.

    Do you know of any decent tutorials which cover the "right" way of passing data both up and down a stack of view controllers?

    Im hoping you might have already produced one...but that may be wishful thinking ;-)
  •  
This conversation is missing your voice. Take five seconds to join Vimeo or log in.

Advertisement

3 Related collections

Statistics

  •  
    plays
    likes
    comments
  • Total
    plays 2,873
    likes 8
    comments 7
  • Jan 2nd
    plays 1
    likes 0
    comments 0
  • Jan 1st
    plays 1
    likes 0
    comments 0
  • Dec 31st
    plays 1
    likes 0
    comments 0
  • Dec 30th
    plays 4
    likes 0
    comments 0
  • Dec 29th
    plays 1
    likes 0
    comments 0
  • Dec 28th
    plays 5
    likes 0
    comments 0
  • Dec 27th
    plays 1
    likes 0
    comments 0
  • Dec 26th
    plays 2
    likes 0
    comments 0
Previous Week

Downloads

Please join Vimeo or log in to download the original file. It only takes a few seconds.