Commits

Anonymous committed 196c248

Only send view appearance etc. messages when changing selection if the tabview is visible

Comments (0)

Files changed (1)

BWTabViewController.m

     
     
     //  Let both ourself and our view controllers know what's going on
-    BOOL viewLoaded = [self isTabViewLoaded];
+    //  Only makes sense to do so if the tabview itself is visible
+    BOOL visible = ([self isTabViewLoaded] && [[self tabView] window]);
     
     [self willChangeValueForKey:@"selectedViewController"];
     [self willSelectViewController:controller];
-    if (viewLoaded) // doesn't make sense to tell controller if there's no tab view to present in yet
+    if (visible) 
     {
         [oldSelection viewWillDisappear:NO];
         [controller viewWillAppear:NO];
     _selectedViewController = controller;
     
     [self didSelectViewController];
-    if (viewLoaded)
+    if (visible)
     {
         [oldSelection viewDidDisappear:NO];
         [controller viewDidAppear:NO];