UITabBar and rotating views, animation?

I have a bunch of views that rotate plus a few that don't (table views), and I just put them all together in a UITabBar, which is great.

But now they don't rotate anymore. Is there a way to tell UITabBarController to pass on the rotation to my view controllers? Do I have to subclass the controller?

Also, is there a way to animate the transition when when the user (or the program) switches to a different view? This would be nice for some transitions, but I don't see a way to do it.

Posted on May 21, 2008 5:37 AM

Reply
10 replies

May 21, 2008 12:26 PM in response to EagerEyes

Animating view switching was a bit tricky because the TabBarController only receives a "didSelectViewController" event and no sort of "willSelectViewController" with old/new as parameters. So what I did was force all the ones not selected to fade out, and force the one selected to fade in. A bit hacky, but it works:


-(void)tabBarController:(UITabBarController*) tbc didSelectViewController:(UIViewController*) newSelection
{
[UIView beginAnimations:@"TabFadeIn" context:nil];
[UIView setAnimationDuration:1.0];
for( UIViewController* vc in tbc.viewControllers )
vc.view.alpha = (vc==newSelection) ? 1 : 0;
[UIView commitAnimations];
}

Aug 19, 2008 11:32 AM in response to Victor Zhang

Are shouldAutorotateToInterfaceOrientation suppose to be past all the way down to the middle controllers? Say you have tabbarcontroller->navbarcontroller->tableviewcontroller. Will the table view controller receives shouldAutorotateToInterfaceOrientation? Because mine doesnt, only the top controller (tab bar one) does....

so say if I want to control different views being able to rotate or not, I have to set some sort of global variables and have that checked by the tabbarcontroller? Seems kind of dumb....

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

UITabBar and rotating views, animation?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.