Florian Faust

Win, Mac and everything in between

  • Increase font size
  • Default font size
  • Decrease font size
Home iPhone OS Breakthrough

Breakthrough

Breakthrough


After spending a few days with the iPhone SDK, to be precisely with XCode, the Interface Builder and tons of documentation, I got a major breakthrough in understanding the connection between content in NIB files and custom classes.

Maybe I just skipped the important parts in the documentation but I found nothing which helped me to get rid of some nasty runtime exceptions when the views are loaded. The name of this class (Delegator) alone indicates some hints about its usage but setting up Outlets and Bindings in a NIB file the first time produced a whole mess of obscuring information.

Never the less I finally played enough around with the Delegator class and then everything fall into place. Now it just works!

I think on the way to a more profound Cocoa or Carbon GUI development some more insights are waiting to be discovered.



So, Step 1 is done: Get a base GUI with custom classes running.

Step 2 is scaling up to more than one NIB file.

Steps afterwards are proper setup of the bindings, and adding persistent data storage.


--The simplified class diagram about my current understanding of the NIB/XCode dependencies--

Class Diagram of Cocoa GUI

 

You can define the complete layout of your GUI in the NIB file. For all controllers or views which should be enhanced by custom code you simply create classes derive from the appropriate GUI class in XCode. The Delegator class then gets an IBOutlet property of your just created class type which you can connect in the Interface Builder to the appropriate GUI object.

Thats it, no nasty exceptions anymore. At least for now Winken