Re: [iphone] Release Navigation View Controller Question
Re: [iphone] Release Navigation View Controller Question
- Subject: Re: [iphone] Release Navigation View Controller Question
- From: Philip Vallone <email@hidden>
- Date: Sun, 17 Jan 2010 06:44:40 -0500
Thanks Tom. Great explanation!
On Jan 17, 2010, at 6:05 AM, Tom Davie wrote:
> Yes, that code is 100% fine.
>
> Here's the logic from purely your point of view.
>
> You allocate browserviewController and in doing so take ownership.
> You do some stuff with browserviewController.
> You are finished with browserviewController, and don't want to do anything else with it, so you resign ownership.
>
> From a more global perspective, the navigationController becomes interested in browserviewController when you ask it to push it, and it too takes ownership, so when *you* release, the navigationController still has a handle on the controller, and keeps hold of it until it decides it's done with it.
>
> Bob
>
> On Sun, Jan 17, 2010 at 10:30 AM, Philip Vallone <email@hidden> wrote:
>
> Hi,
>
> I have Navigation based application. When I switch from one view to the next I use the following code. In the below code, is it ok to release "browseviewController"?
>
>
> BrowseViewController *browseviewController = [[BrowseViewController alloc] initWithNibName:@"BrowseViewController" bundle:nil];
> [browseviewController setTitle:@"Browse By Title"];
> [self.navigationController pushViewController:browseviewController animated:YES];
> // ok to release?
> [browseviewController release];
>
>
> Thanks,
>
> Phil_______________________________________________
>
> 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
>
_______________________________________________
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