How can I display a splash screen for a longer period of time than the default time on an iPad?

亡梦爱人 提交于 2019-12-11 05:05:54

问题


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.


回答1:


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

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"];

}


来源:https://stackoverflow.com/questions/13454144/how-can-i-display-a-splash-screen-for-a-longer-period-of-time-than-the-default-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!