IOS Programming Tutorial (8): Add a startup screen in your application

Source: Internet
Author: User

Although you may think that you need to write the code for the flash screen, Apple can easily compile it in Xcode. No encoding is required. You only need to set some configurations.

What is a pop-up screen? For those who are new to code, they may not have heard of the "pop-up screen". Let me give a simple explanation first. Pop-up screens are common in iOS applications and other desktop applications. This is the first screen you see when you start an application. Normally, the initial screen is an image that overwrites the entire screen. After it disappears, it loads the main screen. Displays the following screen types:

Simple pop-up screen (start page)

The main purpose of the pop-up screen is to let users know that your program is being loaded and provide users with an introductory screen to display your brand. The boot screen is a particularly important application and takes a longer time to start. Moreover, it provides a better user experience.

Add a pop-up screen in your application

As mentioned above, it does not need to write any code to display the startup screen. IOS has a built-in function calledLaunch image (enable image). This image is automatically displayed when you open the application until the application is ready for use. In Xcode, you can simply specify to enable the pop-up image, which will process your remaining work.

Prepare a splash screen

As you know, iPhone 4/4S supports higher screen resolutions (called retina screens ). To support these two screens, the resolution is the old iPhone model and the latest model, you must prepare two versions of the boot image, which are:

> 320x480 (For iPhone 2G/3G/3GS)

> 640x960 (for iphone 4/4S)

For simplicity, I will show you how to add a boot screen to the iPhone application. If you are creating an iPad application, you can refer to Apple iOS introduction to startup screen size and man-machine interface naming conventions.

The image is in PNG format. For lower screen scenes, your image file should be named default.png ". For image display, the file name is “ult@2x.png. In iOS, "2 times" is a standard proportion. All images used for the Retina screen are named with the suffix "@ 2x.

If you cannot use "Default" as your startup image name, you can change your preferred choice. Start the Info. plist setting of the image name in your application. Using a simple table application as an example, you can add a new property called "Launch image (Boot image)" to Info. plist of SimpleTable and specify a value (for example, MyLaunchImage ).

Then the program will use unzip mylaunchimage.png "and" MyLaunchImage@2x.png "as the boot image.

You can design your own boot screen.

Flash screen of our simple table Application

Add a startup image to XCode

After preparing the startup image, return to Xcode and open your Xcode project. Here, we will continue to use our simple table project. Right-click the "SimpleTable" project and select "add file to SimpleTable ". Add the named “ult.png and Default@2x.png to the project.

Add the file to the Xcode Project

If everything you do is correct, you will see the two files in your project, Xcode automatically recognizes the image as a startup image.

Add a startup image in Xcode

Start testing

Run your application again. At this time, you will see a transient display. At present, there is not much time to start and load the application. (Note: The initial screen is displayed for only one second and disappears .)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.