Discussion in 'iOS Programming' started by chaonic, Jul 27, 2008.

  1. chaonic macrumors newbie

    Feb 22, 2008
    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...

    [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?

  2. kainjow Moderator emeritus


    Jun 15, 2000
    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.
  3. chaonic thread starter macrumors newbie

    Feb 22, 2008
    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?

Share This Page