Re: Newbie question
Re: Newbie question
- Subject: Re: Newbie question
- From: Andy Lee <email@hidden>
- Date: Wed, 11 Feb 2009 14:22:33 -0500
On Feb 11, 2009, at 7:45 AM, TrePos wrote:
Sorry to bother with a newbie question but I'm kinda stuck. I fail
to grasp the concept of interface builder. I know it sort of
generates object meta information which is instantiated at program
startup and thus eases the UI design process. I just have difficulty
understanding how the 'connection' between IB defined objects and
'coded' objects work. The IB user manual is great but mostly
explains the usage of the program but not so much about underlying
concept.
Here's the general idea:
You use IB to construct objects. Windows, views, controllers, your
app delegate, model objects, etc. -- they are all objects. You
specify what (1) classes to instantiate, (2) what values to assign to
their properties, and (3) how the objects are connected (the "object
graph"). When you save the nib file, this is the information you are
saving.
The corresponding operations in code would be (1) alloc/init, (2)
setter methods that take an attribute argument (like a number or a
string), and (3) setter methods that take an object argument.
(Actually I'm not sure offhand if (2) and (3) are done with KVC -- I'm
sure the docs can clarify this. The idea is the same regardless.)
You use IB to draw a picture of the object graph you want to create.
At runtime when the nib is loaded, messages are called to perform (1),
(2), and (3) in an appropriate order. You don't have to think about
the order, and you don't have to code all the nitty-gritty messages.
As a bonus, after the object graph has been fully constructed, every
object in it gets an -awakeFromNib message which allows you to hand-
code further operations.
Is there any doc/web page/ or book that some one can refer to? Or
maybe the advise is to hand code everything, I don't know.
I'm not sure if there's a "bible" for IB other than either the Apple
docs, Hillegass, and/or Fritz Anderson's "Xcode Unleashed," but the
advice is definitely *not* to hand-code everything. IB can be a bit
of a hurdle, but it is worth it, and it will make much more sense if
you ever share code, either looking at somebody else's -- Apple's
examples, for example -- or showing them yours.
--Andy
aglee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden