Streetboy
Streetboy

Reputation: 4401

UITabBar navigation and presentModalViewController

I have UITabBar based navigation and want always tabbar on top other widows. In one controller i have method which opens other controller, but when i use this UITabBar disappear. What i should do more ?

ThirdView*third =[[ThirdView alloc] initWithNibName:nil bundle:nil];
third.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.tabBarController presentModalViewController:third animated:YES];
[third release];

Upvotes: 1

Views: 2381

Answers (1)

Michael Frederick
Michael Frederick

Reputation: 16714

You should use UINavigationControllers for the tabs of your UITabBarController. Then to present a new UIViewController you want to push new it onto the stack of your UINavigationController. You can do this like so:

[self.navigationController pushViewController:yourController animated:YES];

If you want the modal effect, you could do something like this:

#import <QuartzCore/QuartzCore.h>

 CATransition* transition = [CATransition animation]; transition.duration = 0.4f;
 transition.type = kCATransitionMoveIn;
 transition.subtype = kCATransitionFromTop;
 [self.navigationController.view.layer addAnimation:transition
                                                 forKey:kCATransition]
 [self.navigationController pushViewController:v animated:NO];

Upvotes: 3

Related Questions