0
votes

in my app, I have an IBAction method to change view to a another view :

-(IBAction)beginGame:(id)sender {
    NSLog(@"beginGame clicked");
    GameView * thisGameView = [[[GameView alloc] init];
    MainAppDelegate * delegate = (MainAppDelegate *) [[ UIApplication sharedApplication] delegate];

    delegate.window.rootViewController = thisGameView;
}

How should I deal with rootViewController property and thisGameView memory management? release thisGameView now?

Please fill me some code in this 'beginGame' method. Thanks.

2

2 Answers

1
votes

If rootViewController property is a retain property, so you can release thisGameView instance after the line:

delegate.window.rootViewController = thisGameView;
0
votes

Yes, you should release thisGameView after assigning it to delegate.window.rootViewController. The assignment will retain it.