Completely remove view/subview

Discussion in 'iOS Programming' started by Niiro13, Oct 20, 2008.

  1. Niiro13 macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #1
    Hi!

    Basically, I have a menu view. When you click a button, the menu adds the respective view as a subview.

    Now when I remove the view from the menu superview, the timers aren't released. In fact, nothing is. The view disappears, but everything that's going on still happens (timers, sounds, accelerometers).

    I have tried remaking the whole thing in a navigation controller and popping the view controller, but it still doesn't work.

    Any suggestions? Thanks!
     
  2. chbeer macrumors member

    chbeer

    Joined:
    Sep 22, 2008
    Location:
    Berlin
    #2
    What did you do to stop the timer, accelerometer events? If you did not stop them the behavior is correct, I think. It can be your intention to remove the view but keep it working in background.
     
  3. Niiro13 thread starter macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #3
    Oh...in that case, I am having trouble stopping the timer as the invalidate method seems to only work if the timer and the invalidate are in the same method (which they're not, because it's a button press that removes the view...which makes the most sense, I think).

    Edit: Nevermind. I found out that I only invalidated the second timer which was useless since the first timer was still being called and therefore, still creating the second timer making it look like it wasn't invalidated.
     

Share This Page