1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

removing view

Discussion in 'iPhone/iPad Programming' started by schenker, Aug 16, 2011.

  1. macrumors newbie

    Hi, i have a number of images and buttons in my current view. Instead of removing one at a time, i removed my uiview like so in viewDidDisappear:
     [currentView removeFromSuperview];
    its saves me so much trouble and it definitely works! but im worried if this is a bad way of doing things. Hope to hear from you guys. Thanks.
  2. macrumors 65816


    in your viewDidDisappear? so your removing it, when your view is already disappearing, I think you're misunderstanding the flow.
    In what kind of way would you do this, or need this.
    I use removeFromSuperview alot. but not in the viewDidDisappear..

    Hope to hear back.
  3. schenker, Aug 16, 2011
    Last edited by a moderator: Aug 16, 2011

    macrumors newbie

    Thanks for replying. This is what happens:

    - this page is actually a level selection game
    - at viewWillAppear, it will determine what are the newly unlocked levels and replace the icons with image of an unlocked icon.
    -it also has to remove the locked image that's now being unlocked --> This is where the problem begins
    - i realise that for the locked image to be completely removed, the uiview has to be refreshed and loadview has to be called again.
    - to 'force' loadview' to be called whenever i come to this screen, i removed the view as mentioned in my previous post.

    it works, but im a little upset if this is right.


    Hi jnoxx, You are right. I need not do it this way. I fine-tuned my code and it works now even without having to use "viewdiddisappear". Thanks so much, your feedback did help me! :)
  4. macrumors 65816


    That's what were here for Schenker! :)

Share This Page