• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[iPhone] Any way to animate a tab-bar away?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iPhone] Any way to animate a tab-bar away?


  • Subject: [iPhone] Any way to animate a tab-bar away?
  • From: WT <email@hidden>
  • Date: Fri, 22 May 2009 12:53:19 +0200

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


  • Follow-Ups:
    • Re: [iPhone] Any way to animate a tab-bar away?
      • From: Brian Slick <email@hidden>
  • Prev by Date: issues encoding MailMessage and NSData
  • Next by Date: Re: Merge 2 QTTracks in a QTMovie
  • Previous by thread: Re: issues encoding MailMessage and NSData
  • Next by thread: Re: [iPhone] Any way to animate a tab-bar away?
  • Index(es):
    • Date
    • Thread