iPhone - 显示动态启动画面

发布于 2024-11-03 08:59:17 字数 136 浏览 2 评论 0原文

我正在创建一个具有选择主题选项的应用程序。根据所选的主题,我还想更改启动屏幕。如果我不使用“Default.png”并使用图像视图或类似的方式来显示启动画面图像,则最终会在加载过程中显示黑色视图。

如何根据所选主题显示动态启动画面。是否可以?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鹤仙姿 2024-11-10 08:59:17

.h 类中编码来添加启动屏幕

此代码可以帮助您通过在.m

UIImageView *myImgView;


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

类中的

- (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;
}

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;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文