简体   繁体   中英

Image View on Xcode Launch Screen appears for a moment then disappears

The logo of my launch screen appears for a moment then disappears. The reason why I separated the logo and the background is because I want to make sure that the logo aspect ratio stays the same on different devices (iPad, iPhone).

The constraints I added to the logo are:

  • Align Center X to: Superview
  • Align Center Y to: Superview 62:85
  • Aspect Ratio Proportional Width to: Background

The constraints I added to background are:

  • Trailing Space to: Superview
  • Leading Space to: Superview
  • Bottom Space to: Superview
  • Top Space to: Superview
  • Proportional width to: logo

现在出现

现在消失

LaunchScreen only appears for short amount of time when application is initialising, then it's showing initial ViewController instantly. For simulator builds and faster devices and smaller apps that loads really fast it will be just a blink.

Also LaunchScreen itself is really limited - you cannot add any custom classes there, code - all you can do is layout it using Constraints.

Only way to animate it nicely is to prepare initial ViewController having exactly same constraints as your LaunchScreen - basically making a copy of it and animate your logo out of the screen nicely via code inside your initial ViewController .

Transition between LaunchScreen and your initial ViewController will be completely invisible for user and it will let you take full control on what is happening next and how transition will look like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM