How can I dynamically load ads on the welcome page in iOS?

Source: Internet
Author: User

How can I dynamically load ads on the welcome page in iOS?

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 is there a welcome page? This is because the program takes some time to start, so a short black screen will appear before loading the main interface, which 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. So the question is, what are the types of welcome interfaces?
  
2. Category of the welcome page
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 iOS 7 and later versions, 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.

The sizes of the welcome page are:
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 IOS9, Apple launched LaunchScreen. storyboard to make the welcome interface. If you want to use LaunchImage to make the welcome interface perfect for IOS7 and ios8. how should we do it?
First, delete LaunchScreen. storyboard. Otherwise, it is automatically called in IOS9. 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 the LaunchScreen. storyboard
IOS9 adds many new features, such as LaunchScreen. storyboard
And Size Classes. When the program starts, it will automatically call LaunchScreen. storyboard. Therefore, you can add the control to be displayed on the xib and add constraints for display.

As shown in, because the above controls are all constraints added in the case of Any w and Any h, they can be adapted to Any device of Any size. 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.

5. 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. Because the page for displaying advertisements is displayed on the welcome page, you can directly use LaunchScreen. Nowhere? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> keys + keys/Uyr7U2tfuyc + keys/keys + aho7T6wuvI58/Cy/nKvqO6PGJyIC8 + keys =" brush: java; ">//// AppDelegate. m // program start /// Created by Apple on 16/4/19. // Copyright? 2016 liuYuGang. all rights reserved. // # import "AppDelegate. h "# import" RootViewController. h "@ interface AppDelegate () @ property (nonatomic, strong) UIView * lunchView; @ end @ implementation AppDelegate-(BOOL) application :( UIApplication *) application didfinishlaunchingwittions tions :( NSDictionary *) launchOptions {self. window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]; // Override point for customization after application launch. self. window. backgroundColor = [UIColor whiteColor]; [self. window makeKeyAndVisible]; RootViewController * root = [[RootViewController alloc] init]; self. window. rootViewController = root; self. lunchView = [[UIView alloc] init]; self. lunchView. frame = CGRectMake (0, 0, self. window. screen. bounds. size. width, self. window. screen. bounds. size. height); [self. window addSubview: self. lunchView]; UIImageView * imageV = [[UIImageView alloc] initWithFrame: CGRectMake (50, 50,320,300)]; UIImage * img = [UIImage imageNamed: @ "123.jpg"]; imageV. image = img; [self. lunchView addSubview: imageV]; [self. window bringSubviewToFront: self. lunchView]; [NSTimer scheduledTimerWithTimeInterval: 3 target: self selector: @ selector (removeLunch) userInfo: nil repeats: NO]; return YES;}-(void) removeLunch {[self. lunchView removeFromSuperview];}

Sat.
1) Pictures displayed when the program starts (Guide diagram)

2) Advertisement Images

3) images displayed when the program runs normally

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.