Some more GUI stuff
After spending a few more hours with the iPhone SDK the picture of Cocoa GUI stuff is much clearer.
But first I have to revise my previous diagram. As expected it is just one way of setting up a GUI with custom classes, the new diagram shows a more complete picture of the concepts and their connections.

Right now there are 3 ways of connecting classes and UI elements:
1.) Change the type of a UI element to one of your customized classes. This lets you customize the behavior of your user interface. E.g. you have a special button you use throughout your application and you don't want to repeat the configuration of a default button. You can solve this also by adding a customized button to the UI library and reuse this one.
2.) Add a class as member to the Delegator and use IB to connected it to an appropriate UI element.
2.1) The type of class and UI element are default Cocoa types. If you want direct access to properties and functions of a UI element from within XCode you can use this way to build the connection.
2.2) The type of class and UI element are custom ones. If you have custom behavior and need direct access to an object you can create the appropriate connection this way.
3.) Create your own controller class derived from a predefined controller class and initialize it with a NIB file. If you don't want to build one big NIB file you can use this way to load the specific files when you need them. All the 3 points from above are valid in this case too, so you can have a “simple” default GUI or a complete customized one with full access.
Aside connecting the NIB content with the XCode content there is another way of connecting content from different NIB files:
1.) Add a new controller to you current NIB document and assign the NIB file you wish to connect to in the controller attributes panel. Depending on the UI element types and connections to classes in the attached NIB file some or all of the above points might be true.
As you can see from my explanations above it depends on the type GUI and level of control to decide which techniques should be used.
Some helping questions for me are:
1.) Do I only need to override the behavior of default UI elements?
2.) Do I need to have direct access to the UI elements?
3.) Do I need custom behavior AND access to the UI elements?
4.) How big is my GUI? Do I need everything at once or can it be split into more parts?
Next Step completed.
Now it's time for persistently storing the model data.
P.S: Some of the details for building a Cocoa GUI are left out to keep the posts shorter respectively I'm assuming that you know some of the basic design patterns used in UI development. If you have any questions feel free to ask so I might put an appropriate post online too. Besides a great source for information is the apple developer connection. They have a lot of infos online. Especially if your new to Apple programming you will find a lot of helpful details there.


