Re: [iPhone] Any way to animate a tab-bar away?
Re: [iPhone] Any way to animate a tab-bar away?
- Subject: Re: [iPhone] Any way to animate a tab-bar away?
- From: Brian Slick <email@hidden>
- Date: Fri, 22 May 2009 08:40:03 -0400
In the view you are animating in, perhaps in the -init method, you can
do this:
[self setHidesBottomBarWhenPushed: YES];
There may be a complication, since it looks like you would want to do
this on the top-most view controller for that tab. I've only ever
done it for subviews, so that the tab bar can reappear when returning
to the parent view. Maybe you could set this for the 'back side' view
you are flipping in. Not sure.
Brian
On May 22, 2009, at 6:53 AM, WT wrote:
Hello,
when tapping one of the items in the tab-bar of my iPhone app, I'd
like to switch to a view that no longer has a tab-bar. I've
accomplished this already by having the tab-bar delegate remove the
tab-bar controller view from its superview (the window) and then
instal the new view. I even got it so that the two views flip like
in an utility app. Here's the code that does it:
[UIView beginAnimations: kAnimationIDSwitchIntoGameView context:
NULL];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector:
@selector(viewSwitchAnimDidStop:finished:context:)];
[UIView setAnimationDuration: kViewSwitchAnimDuration];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:
UIViewAnimationTransitionFlipFromRight
forView: window cache: YES];
[tabBarController.view removeFromSuperview];
[window addSubview: gameViewController.view];
[UIView commitAnimations];
There are two things I'm not happy about though:
1. I'd like the transition to occur in two steps, where the tab-bar
first slides down until it's gone, followed by the view flip. Is it
possible to animate the tab-bar view's frame out of the window? As a
UIView, I'd think so but then the docs say that we shouldn't access
the tab-bar view directly. I suppose I could just give it a try, but
I thought I'd ask people's input first, just in case there may be
some gotchas to look out for.
2. Once the flip happens, the new view is oddly sized, with a gap at
the bottom whose size matches the status bar. I realize that the tab-
bar resizes its current controller's view as needed, and I've tried
several combinations of the options in IB (setting the tab-bar's
controller for that one item to auto-resize or not to auto-resize
its view and changing the autoresizing behaviors of the view in
question are the two most promising ones), but I still can't get the
new view to appear correctly sized. I must admit that I don't really
understand the precise rules followed by the tab-bar controller in
regards to resizing its current view controller's view. Also, I
suspect there's some code I have to write to compensate for killing
the tab-bar, but it's not clear to me what it should be.
You can see what I'm referring to here:
http://www.restlessbrain.com/cocoa-dev/tab-bar.mov
http://www.restlessbrain.com/cocoa-dev/bg_imgview_IB_1.png
http://www.restlessbrain.com/cocoa-dev/bg_imgview_IB_2.png
http://www.restlessbrain.com/cocoa-dev/gameview_IB_1.png
http://www.restlessbrain.com/cocoa-dev/gameview_IB_2.png
http://www.restlessbrain.com/cocoa-dev/tabbar_IB.png
Any help is greatly appreciated.
Wagner
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden