问题描述
我制作了一个支持法语和英语的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.
简单地说,如何为英语和法语添加Default.png?
In simple words, How I add Default.png for English and French?
请让我知道是否有任何方法可以实现此目的.
Please let me know if there is any way to implement this.
推荐答案
您可以动态加载通用屏幕,然后使用特定于语言的屏幕之一进行切换.您可以使用以下代码:
You can dynamically load a universal screen, then switch it up with one of your language specific screens. You can play with this code:
将此添加到您的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:
And in your didFinishLaunchingWithOptions
do thig:
SwitchDefault * switch = [[[SwitchDefault alloc] init] autorelease];
[window addSubview:navigationController.view];
[window addSubview:switch.view];
[window makeKeyAndVisible];
这篇关于运行时启动画面iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!