Re: understanding problem; creation of instances of objects; xCode vs. Menu Builder
Re: understanding problem; creation of instances of objects; xCode vs. Menu Builder
- Subject: Re: understanding problem; creation of instances of objects; xCode vs. Menu Builder
- From: Graham Cox <email@hidden>
- Date: Sat, 6 Jun 2009 11:00:12 +1000
On 06/06/2009, at 7:20 AM, Martin Batholdy wrote:
I think I have a major understanding problem ...
And I just don't know how to solve the problem.
I have a methodfile X
and a methodfile Y
And I have a window that I have set up in the Interface Builder.
The window is connected with the method Y.
How do you mean "the window is connected with the method"? This
sentence doesn't make sense.
From what you say below I think you mean that you have a class "Y". A
class is not a method, and a method is not a class.
So, when the program starts, the window pops up and
because of the window-creation - an instance of Y was created
(right?).
Maybe, maybe not. If you have an instance of a class "Y" in IB, then
yes, it will be created. On the other hand windows can be displayed
anyway because they are separate objects - if you have "visible at
launch" checked then they get shown regardless.
Now when I create an instance of Y inside of X -
how can I get access to that created window?
Do you mean you have a class "X" that has a reference to an instance
of class "Y"? Does X make a new instance of Y or what?
I have now two instances of Y; the one where my window "is in" -
made by the interface builder.
And the one made inside the methodfile X ...
What is a "methodfile"? There's no such thing. Do you mean you have
source files that implement the classes "X" and "Y"?
but how can I get acces to the instance of Y (where the window is
defined) inside of X?
If you have a class X, that owns an instance of class Y, and Y refers
to a window inside a nib file, the usual pattern is to make X "File's
Owner" of the nib and create instances (of Y, say) within IB and
connect them to outlets in File's Owner. File's Owner is a class that
is supplied external to the nib, everything else is supplied within
the nib. It is through Files Owner that you can make connections
between code in your app and objects in your nib.
Alternatively Y could be Files Owner and X creates Y. Either way would
be reasonable.
So try searching the documentation for "File's Owner", that should help.
But pay attention to using appropriate and correct terminology. People
can't really help you if you invent your own terms for things that
make sense only to you, yet are close to terminology used for other,
unrelated things. It just creates confusion. I wouldn't be surprised
if this is of little help to you, because your original question is so
confusingly phrased.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden