Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chaonic

macrumors newbie
Original poster
Feb 22, 2008
12
0
Ok, I have a completely n00b question...

When I'm done with a view, how do I delete it completely so that it does not continue to occupy memory?

I'm thinking it's like this...

Code:
[view1 removeFromSuperview];
[view1 release];

Apple's documentation mentions that "the receiver is also released." Does that mean that you do not need to "release" the object after removing it from the superview?

Thanks!
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
When a view is added to a subview, it is retained. When it is removed, it is released. You only need to release it explicitly if you retained it in the first place before adding it to the subview.
 

chaonic

macrumors newbie
Original poster
Feb 22, 2008
12
0
Another question about releasing objects...

Thanks kainjow. I have one more question regarding releasing objects.

If create and place objects in an array, are they released when the array is released... or do you need to release the objects individually and then release the array?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.