Re: Object References in Obj-C
Re: Object References in Obj-C
- Subject: Re: Object References in Obj-C
- From: Clark Cox <email@hidden>
- Date: Mon, 23 May 2005 11:07:22 -0400
On 5/23/05, Iain Delaney <email@hidden> wrote:
> Hi all,
> Here's my situation: My AppController has a dictionary of
> objects. One of these objects creates a worker object that may need
> to get information from another object in the dictionary. Do Obj-C
> objects know anything about the object that instantiated them?
No, they don't.
> Or should I pass a pointer to the parent or AppController around?
>
> Right now, I've got a member variable of type (AppController *)
> MyApp that I set with self from inside the AppController class, but
> I'm not that comfortable with that. Is this the right way to do
> things, or is there a better way?
You could pass it as a parameter to the object's -init... method(s).
You could add a set... method to the class and call it from the AppController.
If the object is instantiated in a nib, you could make the member
variable an outlet, and connect it in IB.
--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden