Chapter4 Code Question

Anonymous
2011-05-17
2013-04-26

  • Anonymous
    2011-05-17

    In the doStateChange method of the application delegate, can someone explain whey the viewController.view needs to be removed from it's superview and released? Wont the assignment release the view?

    - (void) doStateChange: (Class) state
    {
    BOOL animateTransition = true;

    if(animateTransition){
    ;
    ;
    ; //does nothing without this line.
    }

    if( viewController.view != nil ) {
    ; //remove view from window's subviews.
    ; //release gamestate
    }

    viewController.view = [  initWithFrame:CGRectMake(0, 0, IPHONE_WIDTH, IPHONE_HEIGHT) andManager:self];

    //now set our view as visible
        ;
        ;

    if(animateTransition){
    ;
    }
    }