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 <philip.vall...@verizon.net > 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 (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/tom.davie%40gmail.com > > This email sent to tom.da...@gmail.com > _______________________________________________ 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