restore a lost view message
authorkoda
Fri, 11 Nov 2011 00:23:09 +0100
changeset 6319 b57a37a94ad3
parent 6318 ca12368acc16
child 6320 238a6dc0e7ad
restore a lost view message
project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m
project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m
--- a/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m	Thu Nov 10 17:37:24 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m	Fri Nov 11 00:23:09 2011 +0100
@@ -284,5 +284,18 @@
     [super dealloc];
 }
 
+
+-(void) viewWillDisappear:(BOOL)animated {
+    // this will send -viewWillDisappear: only the active view
+    [self.tabController viewWillDisappear:animated];
+    // let's send that to every page, even though only GeneralSettingsViewController needs it
+    [generalSettingsViewController viewWillDisappear:animated];
+    [teamSettingsViewController viewWillDisappear:animated];
+    [weaponSettingsViewController viewWillDisappear:animated];
+    [schemeSettingsViewController viewWillDisappear:animated];
+    [supportViewController viewWillDisappear:animated];
+    [super viewWillDisappear:animated];
+}
+
 @end
 
--- a/project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m	Thu Nov 10 17:37:24 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m	Fri Nov 11 00:23:09 2011 +0100
@@ -68,7 +68,6 @@
         self.baseController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
 
         [self.view addSubview:self.baseController.view];
-        // here setting activeController is not needed as the event is kept active by the uitabbarcontroller
     }
 
     [super viewDidLoad];
@@ -104,26 +103,31 @@
 
 
 #pragma mark -
-#pragma mark additional methods as we're using a UINavigationController programmatically
+#pragma mark view event management propagation
+// every time we add a uiviewcontroller programmatically we need to take care of propgating such messages
 // see http://davidebenini.it/2009/01/03/viewwillappear-not-being-called-inside-a-uinavigationcontroller/
 -(void) viewWillAppear:(BOOL)animated {
+    [self.activeController viewWillAppear:animated];
+    [self.baseController viewWillAppear:animated];
     [super viewWillAppear:animated];
-    [self.activeController viewWillAppear:animated];
 }
 
 -(void) viewWillDisappear:(BOOL)animated {
+    [self.activeController viewWillDisappear:animated];
+    [self.baseController viewWillDisappear:animated];
     [super viewWillDisappear:animated];
-    [self.activeController viewWillDisappear:animated];
 }
 
 -(void) viewDidAppear:(BOOL)animated {
+    [self.activeController viewDidAppear:animated];
+    [self.baseController viewDidAppear:animated];
     [super viewDidLoad];
-    [self.activeController viewDidAppear:animated];
 }
 
 -(void) viewDidDisappear:(BOOL)animated {
+    [self.activeController viewDidDisappear:animated];
+    [self.baseController viewDidDisappear:animated];
     [super viewDidUnload];
-    [self.activeController viewDidDisappear:animated];
 }