iOS programming Tutorial (eight): Add a splash screen to your app

Source: Internet
Author: User

Although you might think that you need to write the splash screen code, Apple has been able to make it very easy to do in Xcode. no coding is required. All you have to do is set some configuration.

What is a splash screen? for those who have learned the code, may not have heard of the "splash screen", let me first make a simple explanation. splash screens are common in iOS apps, as well as other desktop applications. This is the first screen you see when you launch an application. Typically, the splash screen is an image that covers the entire screen and disappears after the main screen is loaded. Several splash screens are displayed:

Simple splash screen (Start page)

The main purpose of the splash screen is to let the user know that your program is loading and give the user an introductory screen that shows your brand. The splash screen is particularly important for applications that take longer to boot. Moreover , it provides a better user experience.

Add a splash screen to your app

as mentioned earlier, it does not need to write any code to display the splash screen. iOS comes with a built-in function called launch image (boot image). This picture is automatically displayed when the user opens the application and disappears until the application is fully ready to use. In Xcode You can simply specify a splash screen image that will handle the rest of your work.

Preparing the splash screen

as you know, the IPhone 4/4s supports a higher screen resolution (called a Retina screen). to support both screens, the resolution is the old iphone model and the latest model, you have to prepare two versions of the splash screen image, these sizes are:

>320x480 (for IPHONE2G/3G/3GS)

>640x960 (for iphone 4/4s)

for the sake of simplicity, I'll show you how to add a splash screen in the iphone app. If you are building an ipad app, you can refer to the Apple iOS Introduction to the boot screen size and the Man-machine interface guidelines naming convention .

The splash screen image is in PNG format. By default, your image file should be named "Default.png" for a lower screen resolution. for images for Retina display (that is, 640x960 screen resolution), name the file "[email protected] ". On iOS,"twice Times" is a standard scale. All images used for the Retina screen will be named with "@2x" as the suffix.

If you can't use "Default" as your startup picture name, you can change your preferences. Start the Info.plist settings for the image name in your app . using a simple table application as an example , you can add a new property called "Launch image (boot image)" To Simpletable's info.plist, and specify a value (for example, Mylaunchimage).

then the program will use "Mylaunchimage.png" and " [email protected] "as the boot image.

You can design your own splash screen.

The splash screen of our simple table application

Add a splash image to Xcode

when you're ready to start the image, go back 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 Files to simpletable. Add the named "Default.png" and " [email protected] " to the project.

To add a file to the Xcode project

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

Add a splash picture in Xcode

Start testing the

run your application again. This time, you will see a splash screen instantly displayed. now, there's not much to do when the application starts loading, so it doesn't take much time. (Note: The splash screen only shows one second and disappears.) )

iOS programming Tutorial (eight): Add a splash screen to your app

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.