如何在iPad上显示启动画面的时间比iPad上的默认时间长? [英] How can I display a splash screen for a longer period of time than the default time on an iPad?

查看:150
本文介绍了如何在iPad上显示启动画面的时间比iPad上的默认时间长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了很多方式来显示启动画面更长一段时间但我没有得到完美的解决方案,请帮帮我。

I have try so many way in display the splash screen for a longer period of time but i did't get perfect solution,please help me out.

推荐答案

只需将splashView定义为 UIImageView 然后在 didFinishLaunchingWithOptions 方法写下这种类型的代码......

in AppDelegate.m file just define splashView as a UIImageView and then in didFinishLaunchingWithOptions method write this type of code...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    splashView = [[UIImageView alloc] initWithFrame:iphoneFrame];
    splashView.image = [UIImage imageNamed:@"yourImageName"];
    [self.window addSubview:splashView];
    [self performSelector:@selector(loadViewIphone) withObject:nil afterDelay:4.0];// define time which you want..
    [self.window makeKeyAndVisible];
    return YES;
}

并且在loadViewIphone方法中只需删除此splashView,如下所示

and in loadViewIphone method just remove this splashView like bellow

-(void)loadViewIphone 
{
    [splashView removeFromSuperview];
    self.window.rootViewController = self.tabBarController;// or any viewontroller instead of tabbarController
    [self.window makeKeyAndVisible];

    // this bellow code is used for transactionaly swap splashscreen to our viewcontroller..
    CATransition *animation = [CATransition animation];
    [animation setDelegate:self];   
    [animation setType:kCATransitionFade];
    [animation setDuration:0.5];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                  kCAMediaTimingFunctionEaseInEaseOut]];
    [[self.window layer] addAnimation:animation forKey:@"transitionViewAnimation"];

}

这篇关于如何在iPad上显示启动画面的时间比iPad上的默认时间长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆