Search code examples
iphonesplash-screen

Runtime splash screen iPhone


I made a iPhone application which supports French and English languages. When application is loading there is black screen appears initially. Instead of this I want to add splash screens for French and English. Both splash screens are different. When language is French it will load French splash screen and when language is English, it will load English splash screen.

In simple words, How I add Default.png for English and French?

Please let me know if there is any way to implement this.


Solution

  • You can dynamically load a universal screen, then switch it up with one of your language specific screens. You can play with this code:

    Add this to your AppDelegate.m

    @interface SwitchDefault : UIViewController {}
    @end
    @implementation SwitchDefault
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        /* use an if statement here to display a specific French / English spash  */ 
        UIImageView *switch = @"English.png";    
        self.view = switch;  
    
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:2.0];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(imageDidFadeOut:finished:context:)];
        /*  add a fade into your app  */
        [UIView commitAnimations];
    
    }
    - (void)imageDidFadeOut:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{
        [self.view removeFromSuperview];
    }
    @end
    

    And in your didFinishLaunchingWithOptions do thig:

    SwitchDefault * switch = [[[SwitchDefault alloc] init] autorelease];
    [window addSubview:navigationController.view];
    [window addSubview:switch.view];
    [window makeKeyAndVisible];