Hello all,

I've now tried Dave's suggestion and it doesn't quite work. Please take a look here:

http://www.restlessbrain.com/cocoa-dev/tab_bar2/

where you'll see a short video, a source file with the relevant pieces of code that produce what you see in the video, and screen shots of how 2 of the views (the 'intro' view and the game view), and their background image views, are set up in IB.

Note how the sliding away of the tab-bar sort-of works, but not quite, and note also how the game view image is oddly sized after the flip transition. Additionally, there is a pair of highlights coming from the two buttons in the game view which also appear displaced.

If anyone can shed some light on why these anomalies are happening, I'd be very grateful.

Thanks!
Wagner

==========

Hi Dave,

yes, that's what I was considering trying but decided to ask the list first. I'll give it a try later today and will report back one way or the other, for the benefit of other people in the list.

Thanks for your input.

Wagner

On May 22, 2009, at 3:18 PM, Dave DeLong wrote:

Here's something that might work, although I haven't personally tried it.

You know when the game view appears, via the -viewWill/DidAppear: methods. You also know that your game view has a pointer to the parent tabBarController, via UITabBarController * parentTabBar = [self tabBarController];

You could easily resize parentTabBar's view in your viewWill/ DidAppear methods. If you want the bar to go away, then make the parentTabBar.view.frame.size.height grow the height of the TabBar. If you want it animated, do it in a [UIView beginAnimations:nil context:nil] block.

In the other viewControllers, you'll need to resize the UITabBarController's view back to its original size.

HTH,

Dave

On May 22, 2009, at 7:09 AM, WT wrote:

Hi Brian,

thanks for replying. Your suggestion didn't work and I suspect it was because I'm not using a navigation controller. The UIView documentation for the hidesBottomBarWhenPushed property seems to suggest that it only has an effect when the view is pushed into a navigation controller's stack.

In my app, the 4 views controlled by the tab-bar are not stacked, so there is no need for a navigation controller more sophisticated than the tab-bar controller. The only difference between the four views, as far as navigation is concerned, is that switching into the game view hides the tab-bar. One would reasonably think that your suggestion would work in that case too, but it doesn't. :(

Wagner

On May 22, 2009, at 2:40 PM, Brian Slick wrote:

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 (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