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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to