Commits

Anonymous committed a27fa40

Not sending -viewWillAppear: -viewDidAppear: to view controllers until a tabview is present to load them into

Comments (0)

Files changed (1)

BWTabViewController.m

 
 // Propogating selection to tabview is performed by binding.
 @synthesize selectedViewController = _selectedViewController;
-- (void)setSelectedViewController:(NSViewController *)controller
+- (void)setSelectedViewController:(NSViewController *)controller;
 {
     // Ignore request to redisplay existing selection
     NSViewController *oldSelection = [self selectedViewController];
     
     
     //  Let both ourself and our view controllers know what's going on
+    BOOL viewLoaded = [self isTabViewLoaded];
+    
     [self willChangeValueForKey:@"selectedViewController"];
     [self willSelectViewController:controller];
-    [oldSelection viewWillDisappear:NO];
-    [controller viewWillAppear:NO];
+    if (viewLoaded) // doesn't make sense to tell controller if there's no tab view to present in yet
+    {
+        [oldSelection viewWillDisappear:NO];
+        [controller viewWillAppear:NO];
+    }
     
     [_selectedViewController release], _selectedViewController = [controller retain];
     
     [self didSelectViewController];
-    [oldSelection viewDidDisappear:NO];
-    [controller viewDidAppear:NO];
+    if (viewLoaded)
+    {
+        [oldSelection viewDidDisappear:NO];
+        [controller viewDidAppear:NO];
+    }
     [self didChangeValueForKey:@"selectedViewController"];
 }