Im trying to add a transition effect between my two UIControllers. The switching between them is working perfectly but i would like to add a nice transition effect.
This is my AppDelegate.m
@implementation LaMetro_88AppDelegate
@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.window.rootViewController = self.tabBarController;
}
This code does the switch between the controllers and its working fine.
In order to have a transition animation, the tab bar controller must be presented. Try it this way (I have not tested this):
Looking at your code, it may be that you want to present a splash vc. If it only needs to be there to present a logo, then the timer approach is okay. (though, you might want to consider performSelector:withObject:afterDelay: which is a little prettier way to conceal that timer).
If the splash vc needs to do some work before the app is ready to run (like sign in, or something else that takes long enough to do asynchronously), I encourage you to check out this approach I suggest).