简体   繁体   中英

Launch screen on xcode 6 - ios 8

I am building my own app (but I'm a beginner) and I want to know if there are tutorials about "launch screens" in Xcode6. I also want to know if it is possible to test the internet connexion before displaying the storyboard. Thanks for your answers ! :)

I think this will help:

http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/

Also, I would recommend not making the display of your storyboard wait until after you test the internet connection, as this could make the launch of your app slow.

If you are using a Storyboard by declaring it in your plist file as is typically done, then this is the order in which events occur:

  1. It instantiates the app delegate based on the class name you passed into the UIApplicationMain function.
  2. It creates a new window attached to the main screen.
  3. If your app delegate implements a window property, iOS sets this property to the new window.
  4. It loads the main storyboard referenced in the app's information property list file.
  5. It instantiates the main storyboard's initial view controller.
  6. It sets the window's rootViewController property to the new view controller.
  7. It calls the app delegate's application:didFinishLaunchingWithOptions: method. Your app delegate is expected to configure the initial view controller (and its children, if it is a container view controller).
  8. It calls the window's makeKeyAndVisible method to display the window.

Source: https://developer.apple.com/library/ios/featuredarticles/viewcontrollerpgforiphoneos/ManagingDataFlowBetweenViewControllers/ManagingDataFlowBetweenViewControllers.html#//apple_ref/doc/uid/TP40007457-CH8-SW1

Therefore the storyboard and initial view controller will have already been instantiated by the time application:didFinishLaunchWithOptions:. If you really needed to do the connection test before the storyboard was loaded then you could not declare the storyboard in your plist and you could load the Storyboard programatically in your application:didFinishLaunchWithOptions: method after you have done your test. I would not recommend this however.

I am adding here the steps in short for creating the LaunchScreen through xib instead of using storyboard for iOS 8. This could be useful for persons like me, searching for how to create Launch Screen in iOS 8.

1) create a new "LaunchScreen xib" from new file --> user interface --> launch screen ( keep auto layout ON ).

2) Add an image view in the xib --> view (main view).

3) set splash image to it ( the image should not be in assets file ).

4) set image as "Aspect Fit" ( if required ).

5) you may also change the "view" (super view) background color as close to background color of image.

6) select the image view, click from menu - editor - pin - bottom space to super view.

7) this will show red error mark near "view" ( super view of image view ).

8) click on the error mark, you will see approximate two auto layout errors.

9) on clicking on the error you will find menu with auto fix the layout errors.

10) on fixing the errors, you will find total four "Constraints" with "vertical" and "horizontal" space between superview and image.

11) now you may test them in different devices or simulators.

Regards.

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