Re: Newbie Connections Question - Sorry!
Re: Newbie Connections Question - Sorry!
- Subject: Re: Newbie Connections Question - Sorry!
- From: Harilaos Skiadas <email@hidden>
- Date: Tue, 14 Sep 2004 00:38:32 -0700 (PDT)
>Okay, I totally appreciate all the stuff you've been
saying, but I feel
>like the response may be a little too basic than what
I was looking
>for.
Oops! My apologies. I guess I misunderstood your
question, and got a bit carried away eagerly trying to
answer it.
>So what you're telling me is that the only way for a
dynamically
>created object to access any of the objects created
by the Nib is to
>have it directly passed to it? That seems a bit
harsh. I want it to
>access all my other methods in my other objects just
like the ones >that
>are connected through the Nib connections in
interface builder.
>
So, let me see if I understand correctly: The
AdamSprite class has a couple of outlets, say
myAdamController and myAdamView, and in IB you
connected the instance of AdamSprite to the instances
of the other two through those connections. In that
case, if I understand correctly, all you have to do is
tell the instance of AdamSprite that AdamController
creates programmatically where it should connect those
outlets. The outlets are just simple instance
variables, so you could have in AdamSprite something
like:
- (id)initWithController:(id)aController
andView:(id)aView
{
self = [super init];
if (self) {
myAdamController = aController;
MyAdamView = aView;
// I'm relatively sure you don't want to retain them.
}
return self;
}
and then when your controller creates it, it can pass
this information along.
The only thing you need to be careful with in this
case of course is to not end up destroying aController
and aView before destroying all the sprites referring
to them. (which of course would not happen I guess,
since your controller is presumably responsible for
both the view and the sprites, so will release them in
dealloc).
Is this what you wanted to do, or did I miss the point
again?
again, my apologies for posting a bit too basic stuff
on the list.
Haris
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
_______________________________________________
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