Iphone Splash Screen

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 10:49:02

If you add an image to your project named "Default.png" it will act as a splash screen.

Forcing your user to look at a screen any longer than necessary is typically considered bad.

If you do want to add one anyways using addSubview: should work fine, if you'd like animation you may want to look into CATransitions instead of the UIView animations.

Adding the splash screen to the window or the main view controller should appear the same to the user.

Edit: Try this snippet -- you'll need to #include <QuartzCore/QuartzCore.h> and add the QuartzCore framework

// Using a CATransition
    CATransition* transition = [CATransition animation];
    transition.delegate = self; // if you set this, implement the method below
    transition.duration = 0.3;
    transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromRight;
    [self.view.layer addAnimation: transition forKey: nil];
    [self.view addSubview: theNewView];

Add this if you need to do something when the transition is finished:

#pragma mark -
#pragma mark CAAnimation Delegate Methods
- (void)animationDidStop: (CAAnimation*)theAnimation finished: (BOOL)flag
{
    // Whatever you need to do when the animation is done.
}
auspicious99

I don't agree with the first statement in the other answer, that says 'If you add an image to your project named "Default.png" it will act as a splash screen.'

Default.png is the launch image. The Apple HIG specifically distinguishes between launch image and splash screen.

In particular, it says

Avoid using your launch image as an opportunity to provide:

  • An “application entry experience,” such as a splash screen
  • An About window
  • Branding elements, unless they are a static part of your application’s first screen

Hence, for a splash screen, use NSTimer or a button for the user to dismiss the splash screen.

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