运行时闪屏iPhone

时间:2010-12-21 07:26:54

标签: iphone

我制作了支持法语和英语的iPhone应用程序。加载应用程序时,最初会出现黑屏。而不是这个,我想为法语和英语添加启动画面。两个闪屏都不同。当语言为法语时,它将加载法语启动画面,当语言为英语时,它将加载英语启动画面。

简单来说,我如何为英语和法语添加Default.png?

如果有任何方法可以实现,请告诉我。

2 个答案:

答案 0 :(得分:1)

您可以动态加载通用屏幕,然后使用您的某个语言特定屏幕进行切换。您可以使用以下代码:

将此添加到您的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

并在你的didFinishLaunchingWithOptions做thig:

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

答案 1 :(得分:0)

有点晚了。您可以本地化Default.png文件。有关步骤,请参阅http://www.skylarcantu.com/blog/2009/08/19/localization-your-iphone-os-applications-in-xcode/(链接中的过程适用于文本文件,但可以对图像执行相同操作)。

我使用此方法创建了本地化的应用图标,效果很好。

相关问题