Reputation: 291
I have a transition from a UIViewController to a UITabBarViewController, the transition is working perfectly but the time it takes is too fast to appreciate the effect. So I was wondering if there is a way to make this transition animation last longer?
Here is my AppDelegate.m
@implementation AppDelegate
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
@synthesize LoadingViewController = _LoadingViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.rootViewController = self.LoadingViewController;
[self.window addSubview:tabBarController.view];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(changeView) userInfo:nil repeats:NO];
[self.window makeKeyAndVisible];
return YES;
}
-(void)changeView{
self.tabBarController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self.window.rootViewController presentModalViewController:self.tabBarController animated:YES];
}
This code makes a transition between my two controllers. First goes my ViewController and after 2 seconds goes my TabBarViewController. But as I was saying this animation goes too fast.
Upvotes: 2
Views: 1369
Reputation: 20551
use this code...
-(void)changeView{
// self.tabBarController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.5];// increase time duration with your requirement
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
kCAMediaTimingFunctionEaseInEaseOut]];
[[self.window layer] addAnimation:animation forKey:@"transitionViewAnimation"];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
}
Upvotes: 2
Reputation: 3318
What iOS are you targeting? If you are happy with iOS5+, you could use Storyboards and Custom Segues.
Upvotes: 0