i have a tabbar application. here is my code
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[application setStatusBarHidden:YES animated:NO];
[self showSplashView];
}
- (void)showSplashView {
//If i don't use black view it displays white screen thats look so bad...
UIView* blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
blackView.backgroundColor = [UIColor blackColor];
[window addSubview:blackView]; // sends [blackView retain]
[blackView release];
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageNamed:@"MyImage.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
[UIView beginAnimations:nil context:nil ];
[UIView setAnimationDelay:5.0];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:) ];
splashView.alpha = 0.0;
splashView.frame = CGRectMake(-60, -60, 440, 600);
[UIView commitAnimations];
}
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
UIView* blackView = [[window subviews] objectAtIndex:0];
[blackView removeFromSuperview];
[splashView removeFromSuperview];
[splashView release];
[window addSubview:tabBarController.view];
[window makeKeyWindow];
}
so my problem is when my application starts first it displays black screen ,after few second it displays my splash image. when splash screen animation finishes again it displays black screen and after few second it displays my view controller.i dont know why it happens.i hope my question is clear. thanks EDIT My expected behavior is as soon as app start it should display my splash screen instead black screen and as soon as splash animation finish it should display my first view controller(which is table view controller with in first tabbar)..
EDIT 2 : *is it something time consuming in this code [window addSubview:tabBarController.view]; how do i do this process in background while my splash screen is running.*