Creating Launch Screen.xib for iOS8

I just found out that in order to have a description for your application in the application store, say: "This application is optimized for iPhone 6 and iPhone 6 Plus." you need to use the starter XIB or storyboard file for your startup images (in [Apple] [1]).

So, I created a new Launch Screen xib, and now I'm a little, but since I usually do everything in code and do not use the interface constructor. I removed the default label that was inserted and dropped the UIImageView into the view. Now I wonder how I would:

1) Tell UIImageView to resize any screen on it

2) Tell UIImageView to select ImageA if the application is running on the 3.5-inch screen or ImageB if the application is running on the 4-inch screen, etc. etc.

Essentially, I'm just trying to start .xib startup to mimic the behavior of how the startup screen works. I would be grateful if anyone could help with this!

+5
source share
4 answers

You have two options:

  • You use autostart and give imageview a full-screen view (the distance to the top, bottom, left and right is 0). This, however, will crop the image for specific screen sizes, which you might not want. Therefore you can consider (2)

  • Place the startup screen image in the asset catalog and just put different images in different size classes.

+4
source

I found the answer helpful. I am adding short steps to create xib for LaunchScreen for iOS 8.

1) create a new “Xib” LaunchScreen from the new file → user interface → start-up screen (save automatic ON).

2) Add the image view to the xib → view (main view).

3) set a pop-up image for it (the image should not be in the asset file).

4) set the image as “Aspect Fit” (if required).

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

6) select the type of image, click from the menu - editor - pin - lower space for super viewing.

7), a red error mark will appear next to the "view" (super image view).

8) click on the error sign, you will see the approximate two errors of automatic placement.

9) when you click on an error, you will find a menu with automatic correction of layout errors.

10) when fixing errors, you will find four "restrictions" with a "vertical" and "horizontal" space between the superview and the image.

11) Now you can test them on different devices or simulators.

UPDATE: -

For Xcode 9 , Swift 3, or Swift 4 , the following steps are followed:

The first step is to create an image (png or jpeg) in your favorite graphics software.

Create a screensaver with your own full background in size " width 1125 x height 2436. " Please note that the background will be clamped on different sizes of devices.

Depending on what information, graphics, you do not want to be cropped , you must create them in the center of the image above a width of 1125 x height of 1471 . This should always be centered over the full image.

Once the image is ready, you can add it to the xcassets file or save it to the resource.

Now go to the next steps.

1) “LaunchScreen storyboard” has already been created with a new project. Open it.

2) Add an image view to the view.

3) Set the pop-up image saved above to the image view mode.

4) Set the image “Content Mode” of the image as “Aspect Fill”.

5) Add 4 image view restrictions for Top, Bottom, Trailing and Leading to Superview.

This is done for the portrait application popup.

Sincerely.

+4
source

You can resize the image by setting a limit on the top, bottom, front and back edges of the supervisor. Just click on the image and select "Editor" → "Display top context menu." You can also set aspects of UIImageView by clicking on it and installing it, for example, “Aspect Fit”. Make sure that ImageView closes the entire screen before setting limits, otherwise you will have to change the outlines.

To set different images for different screen sizes, I would suggest that you need to create a class and change the viewWillAppear method to load the corresponding image

Good luck Erik

+1
source

Starting xib cannot have a custom class, since your application did not start when it displays. What I ended up with is:

  • use size class function
  • Create 3 user interface images (one for each class)
  • Use automatic layout with restrictions that apply to each dimension class

Thus, when displaying one type of device, the width and height restrictions of the other two UIImageView are set to 0

0
source

Source: https://habr.com/ru/post/1206156/


All Articles