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:
-
UIView
of new tab gets added as a subview -
UIView
of old tab gets removed - The delegate’s
tabBarController:didSelectViewController:
method is called
Run the same code on iPhone OS 3.0, however, and the sequence is this:
-
UIView
of new tab gets added as a subview - The delegate’s
tabBarController:didSelectViewController:
method is called -
UIView
of old tab gets removed (sometime later, I think it’s invoked via one ofNSObject
‘sperformSelector:
methods)
This is a inconsequential change for most, but it might make a difference if you are checking the UIView
s’ superview
variables in your tab bar controller delegate method.
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.