1. mikeabdullah
  2. BWToolkit


Mike Abdullah  committed 196c248

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

  • Participants
  • Parent commits 3c1e8d4
  • Branches default

Comments (0)

Files changed (1)

File BWTabViewController.m

View file
     //  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];