project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
changeset 4354 c4e1820fa792
parent 4098 40df542b5f62
child 4356 d1d26f8963a3
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Wed Nov 24 23:34:10 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Wed Nov 24 23:35:41 2010 +0100
@@ -57,7 +57,7 @@
 }
 
 @implementation SDLUIKitDelegate
-@synthesize mainViewController, uiwindow, secondWindow, isInGame;
+@synthesize mainViewController, overlayController, uiwindow, secondWindow, isInGame;
 
 // convenience method
 +(SDLUIKitDelegate *)sharedAppDelegate {
@@ -77,6 +77,7 @@
 
 -(void) dealloc {
     [mainViewController release];
+    [overlayController release];
     [uiwindow release];
     [secondWindow release];
     [super dealloc];
@@ -153,19 +154,16 @@
 // overlay with controls, become visible later, with a transparency effect
 -(void) displayOverlayLater:(id) object {
     NSDictionary *dict = (NSDictionary *)object;
-    OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
-    overlayController.isNetGame = [[dict objectForKey:@"net"] boolValue];
-    overlayController.useClassicMenu = [[dict objectForKey:@"menu"] boolValue];
+    self.overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
+    self.overlayController.isNetGame = [[dict objectForKey:@"net"] boolValue];
+    self.overlayController.useClassicMenu = [[dict objectForKey:@"menu"] boolValue];
     
     UIWindow *gameWindow;
     if (IS_DUALHEAD())
         gameWindow = self.uiwindow;
     else
         gameWindow = [[UIApplication sharedApplication] keyWindow];
-    [gameWindow addSubview:overlayController.view];
-    //[[[gameWindow subviews] objectAtIndex:0] addSubview:overlayController.view];
-    // don't release a controller according to http://developer.apple.com/library/ios/#qa/qa2010/qa1688.html
-    //[overlayController release];
+    [gameWindow addSubview:self.overlayController.view];
 }
 
 // override the direct execution of SDL_main to allow us to implement the frontend (or even using a nib)