UITabBarController timing change from OS 2.X to 3.0

June 29th, 2009 § 1 comment

This is just a short note about a change I discovered between iPhone OS 2.x and 3.0. It’s not very interesting or exciting but I thought I’d record it in the off chance that it helps someone else.

When the user switches tabs on a UITabBarController in iPhone OS 2.x, the sequence of events is:

  1. UIView of new tab gets added as a subview
  2. UIView of old tab gets removed
  3. The delegate’s tabBarController:didSelectViewController: method is called

Run the same code on iPhone OS 3.0, however, and the sequence is this:

  1. UIView of new tab gets added as a subview
  2. The delegate’s tabBarController:didSelectViewController: method is called
  3. UIView of old tab gets removed (sometime later, I think it’s invoked via one of NSObject‘s performSelector: methods)

This is a inconsequential change for most, but it might make a difference if you are checking the UIViews’ superview variables in your tab bar controller delegate method.

Tagged , ,

§ One Response to UITabBarController timing change from OS 2.X to 3.0

  • tzurs says:

    This actually makes a difference to many people I think that use the following code which I think is very common:
    – (void)tabBarController:(UITabBarController *)controller didSelectViewController:(UIViewController *)viewController
    {
    [UIView beginAnimations:@”TabFadeIn” context:nil];
    [UIView setAnimationDuration:1.0];
    UIView* v = [[viewController view] superview];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:v cache:YES];
    [UIView commitAnimations];
    }

    I have no idea how to accomplish this under 3.0 now that they’ve changed the timing which I believe is the reason for that issue.

What's this?

You are currently reading UITabBarController timing change from OS 2.X to 3.0 at bunnyhero dev.

meta