Hi,

I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see

        // Set up the view controller
MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld" bundle:[NSBundle mainBundle]];
        self.myViewController = aViewController;
        [aViewController release];

I'm a little confused - I see an allocation, followed by an assignment, followed by a release. I think that the assignment is really a call to a setter - the myViewController field is created automagically using the @property/@synthesize syntax.

Since a release was sent to aViewController, what keeps that object from being nuked at the end of the run loop? There must be another retain happening somewhere, right?

Second question - is there anyway to see the code that gets generated by @synthesize? I'm nosy and curious.

Thanks,
Daniel


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to