1
votes

I'm creating an application which has options to select themes. Depending on the theme selected, I want to also change the splash screen. If I don't use "Default.png" and use a image view or similar to show a splash screen image, I end up showing a black view during loading.

How can I show dynamic splash screens depending on the theme selected. Is it possible?

2

2 Answers

1
votes

This code may help you to add splash screen by coding

in .h class

UIImageView *myImgView;


//---------methods to show and hide splash----------
-(void)ShowSplash;
-(void)hideSplash;

in .m class

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    [self ShowSplash];
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    [self.window makeKeyAndVisible];
    return YES;
}

-(void)ShowSplash
{
     myImgView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
     myImgView.backgroundColor=[UIColor colorWithRed:0 green:.3 blue:0.5 alpha:1];
     myImgView.image=[UIImage imageNamed:@"splashscreen.png"];
     [self.window addSubview:myImgView];
     [self performSelector:@selector(hideSplash) withObject:nil afterDelay:1];
}

-(void)hideSplash
{   
    [UIView beginAnimations:@"flipping view" context:nil];
    [UIView setAnimationDuration:1.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp   forView:myImgView.superview cache:YES];
    [myImgView removeFromSuperview];
    [UIView commitAnimations];
    [myImgView release];
    myImgView=nil;
    self.window.rootViewController = self.viewController;
}