IOS welcome interface Launch Screen dynamic loading advertisement, ioslaunch

Source: Internet
Author: User

IOS welcome interface Launch Screen dynamic loading advertisement, ioslaunch

When we open an application, the first thing we see is often not the main interface of the program, but the well-designed welcome interface, which usually stays for a few seconds and then disappears. A seemingly common small welcome interface is actually very exquisite.

1. Why does the welcome page appear?

It takes some time to start the program, so a short black screen will appear before loading the main interface. This is really bad, it will give users a very bad experience. In order to alleviate the user's mental discomfort and irritability during the waiting process, you are welcome to make a debut on the interface!

Replacing the black screen wait with the welcome interface can effectively mask time-consuming background operations and display valid information to users. This is a very good transitional solution. However, it is unwise for some programs to make the welcome interface into an advertisement version, wasting more time on the user, getting bored with the user, and losing interest in the functions of the program itself.

Ii. Types of welcome Interfaces

There are many types of welcome interfaces, which can be static or dynamic.

Static welcome interfaces are usually relatively simple. Generally, they place a very elegant image, which may be a promotional image of a company or product, or an advertisement image, I was most impressed by the opening of a chat software on my birthday. The welcome page turned out to be a picture of my birthday greetings with your name.

The dynamic welcome interface should be more cool and elegant, with richer styles. Some may be online-loaded advertisements, some may be like a dazzling book, slide pages, and some may be a small game, some of them have beautiful music and some may be interesting animations.

3. Use LaunchImage on the welcome page

For IOS7, Apple provides LaunchImage to implement the welcome interface. during development, you only need to drag the picture of the corresponding size to the corresponding status.

 

On IOS7, the following sizes are available on the welcome page:

Iphone portrait screen 640*960 640*1136

Ipad portrait screen 768*1024 1536*2048

Ipad horizontal screen 1024*768 2028*1536

After the emergence of IOS8, Apple launched LaunchScreen. xib to make the welcome interface. If you still want to use LaunchImage to make the welcome interface perfect for IOS7 and IOS8, what should you do?

First, delete LaunchScreen. xib. Otherwise, it is automatically called in IOS8. Find Images. xcassets, click the plus sign below, select New Launch Image, and then add the corresponding size Image as required, which is exactly the same as before.

4. Welcome to LaunchScreen. xib

Xcode6/IOS8 adds many new functions, such as LaunchScreen. xib and Size Classes. When the program starts, it will automatically call LaunchScreen. xib. Therefore, you can add the control to be displayed on this xib and add constraints for display.

As shown in, the current welcome page includes the middle title, the following company information, and an image. Because the above controls are all constraints added in the case of Any w and Any h, they can be adapted regardless of the size of the device. To ensure better results, we can use Images. xcassets to set Images in the xib, so that Images of the corresponding size can be automatically selected for different devices to achieve better results.

The LaunchScreen above. xib is automatically generated by creating a project using Xcode6. If you do not want to use automatic generation, you can change it to another xib. Unfortunately, the xib used for the welcome interface cannot be connected to the View Controller, therefore, only static interfaces can be displayed. You can change the xib in two places.

5. Dynamic advertisement loading on the welcome page

When many applications are opened, the welcome page will load an advertisement image or display a group of animations obtained by the connected network. How can this effect be achieved? The following describes a simple way to load advertisements.

Run the program. After you welcome the interface, you will be directed to AppDelegate. Therefore, you can add the code in application: didfinishlaunchingwitexceptions to complete the desired effect. You can use a third-party SDWebImage to retrieve images from the Internet. Therefore, you must first import the third-party folders. Because the page for displaying advertisements is displayed on the welcome page, you can directly use LaunchScreen. in the xib, add a UIImageView to display the image, add it to the window, and display it on the top. After the ad image is displayed, remove the view to display the main interface of the program. The Code is as follows:

#import "AppDelegate.h"#import "UIImageView+WebCache.h"@interface AppDelegate ()@property (strong, nonatomic) UIView *lunchView;@end@implementation AppDelegate@synthesize lunchView;- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {        [self.window makeKeyAndVisible];        lunchView = [[NSBundle mainBundle ]loadNibNamed:@"LaunchScreen" owner:nil options:nil][0];    lunchView.frame = CGRectMake(0, 0, self.window.screen.bounds.size.width, self.window.screen.bounds.size.height);    [self.window addSubview:lunchView];        UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 320, 300)];    NSString *str = @"http://www.jerehedu.com/images/temp/logo.gif";    [imageV sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"default1.jpg"]];    [lunchView addSubview:imageV];        [self.window bringSubviewToFront:lunchView];        [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(removeLun) userInfo:nil repeats:NO];       return YES;}-(void)removeLun{    [lunchView removeFromSuperview];}

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.