project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m
changeset 6076 e1b4771f6472
parent 6075 0173cd44c3bc
child 6078 8c0cc07731e5
equal deleted inserted replaced
6075:0173cd44c3bc 6076:e1b4771f6472
    22 #import "SettingsContainerViewController.h"
    22 #import "SettingsContainerViewController.h"
    23 #import "SettingsBaseViewController.h"
    23 #import "SettingsBaseViewController.h"
    24 #import "CommodityFunctions.h"
    24 #import "CommodityFunctions.h"
    25 
    25 
    26 @implementation SettingsContainerViewController
    26 @implementation SettingsContainerViewController
    27 @synthesize activeController, splitViewRootController;
    27 @synthesize baseController, activeController, splitViewRootController;
    28 
    28 
    29 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    29 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    30     return rotationManager(interfaceOrientation);
    30     return rotationManager(interfaceOrientation);
    31 }
    31 }
    32 
    32 
    57         [rightNavController release];
    57         [rightNavController release];
    58 
    58 
    59         // add view to main controller
    59         // add view to main controller
    60         [self.view addSubview:self.splitViewRootController.view];
    60         [self.view addSubview:self.splitViewRootController.view];
    61     } else {
    61     } else {
    62         SettingsBaseViewController *baseController = [[SettingsBaseViewController alloc] init];
    62         if (nil == self.baseController) {
    63         baseController.targetController = nil;
    63             SettingsBaseViewController *sbvc = [[SettingsBaseViewController alloc] init];
    64         baseController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
    64             self.baseController = sbvc;
    65         [self.view addSubview:baseController.view];
    65             [sbvc release];
       
    66         }
       
    67         self.baseController.targetController = nil;
       
    68         self.baseController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
       
    69 
       
    70         [self.view addSubview:self.baseController.view];
    66         // here setting activeController is not needed as the event is kept active by the uitabbarcontroller
    71         // here setting activeController is not needed as the event is kept active by the uitabbarcontroller
    67     }
    72     }
    68 
    73 
    69     [super viewDidLoad];
    74     [super viewDidLoad];
    70 }
    75 }
    71 
    76 
    72 #pragma mark -
    77 #pragma mark -
    73 #pragma mark Memory management
    78 #pragma mark Memory management
    74 -(void) didReceiveMemoryWarning {
    79 -(void) didReceiveMemoryWarning {
       
    80     if (self.baseController.view.superview == nil)
       
    81         self.baseController = nil;
       
    82     if (self.activeController.view.superview == nil)
       
    83         self.activeController = nil;
    75     if (self.splitViewRootController.view.superview == nil)
    84     if (self.splitViewRootController.view.superview == nil)
    76         self.splitViewRootController = nil;
    85         self.splitViewRootController = nil;
    77     if (self.activeController.view.superview == nil)
       
    78         self.activeController = nil;
       
    79     MSG_MEMCLEAN();
    86     MSG_MEMCLEAN();
    80     [super didReceiveMemoryWarning];
    87     [super didReceiveMemoryWarning];
    81 }
    88 }
    82 
    89 
    83 -(void) viewDidUnload {
    90 -(void) viewDidUnload {
       
    91     self.baseController = nil;
    84     self.activeController = nil;
    92     self.activeController = nil;
    85     self.splitViewRootController = nil;
    93     self.splitViewRootController = nil;
    86     MSG_DIDUNLOAD();
    94     MSG_DIDUNLOAD();
    87     [super viewDidUnload];
    95     [super viewDidUnload];
    88 }
    96 }
    89 
    97 
    90 -(void) dealloc {
    98 -(void) dealloc {
       
    99     releaseAndNil(baseController);
    91     releaseAndNil(activeController);
   100     releaseAndNil(activeController);
    92     releaseAndNil(splitViewRootController);
   101     releaseAndNil(splitViewRootController);
    93     [super dealloc];
   102     [super dealloc];
    94 }
   103 }
    95 
   104