• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iphone] Release Navigation View Controller Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iphone] Release Navigation View Controller Question


  • Subject: Re: [iphone] Release Navigation View Controller Question
  • From: Tom Davie <email@hidden>
  • Date: Sun, 17 Jan 2010 11:05:36 +0000

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

  • Follow-Ups:
    • Re: [iphone] Release Navigation View Controller Question
      • From: Philip Vallone <email@hidden>
References: 
 >[iphone] Release Navigation View Controller Question (From: Philip Vallone <email@hidden>)

  • Prev by Date: [iphone] Release Navigation View Controller Question
  • Next by Date: Re: NSTextField sendActionOn:
  • Previous by thread: [iphone] Release Navigation View Controller Question
  • Next by thread: Re: [iphone] Release Navigation View Controller Question
  • Index(es):
    • Date
    • Thread