iOS Welcome interface Launch screen dynamic load ad

Source: Internet
Author: User

When we open an application, it is often not the main interface of the program, but the well-designed welcome interface, which usually stops for a few seconds and then disappears. Seemingly very ordinary a small welcome interface, in fact, there is a lot to pay attention to.

First, why does the welcome interface appear?

The program will take some time to start the process, then before loading the main interface, there is a short black screen, this is really a bad thing, will give users a very bad experience. In order to ease the user waiting process psychological discomfort and irritability, welcome to the interface of the shiny debut!

The welcome interface to replace the black screen waiting, can effectively cover up the time-consuming blocking background operations, but also to show users effective information, is a very good transition program. But some procedures to make the welcome interface into a advertising version, wasting more time users, let users feel bored, the program itself has lost interest in the function, this practice is very unwise.

Second, the type of welcome interface

There are many kinds of welcome interface, which can be divided into two kinds: static and dynamic.

Static welcome interface is usually relatively concise, generally will be placed a very beautiful picture, may be a company or product propaganda map, may also be an advertising map, give me the deepest impression is a chat software on the birthday of the Open, welcome interface unexpectedly is a write your name of the birthday blessing picture, let people feel very warm.

Dynamic welcome interface to be more cool and beautiful, style is more rich, some Internet-loaded ads, and some like a very flashy book, you can slide the page, there is a small game, some beautiful text with wonderful music, there may be a funny animation.

Third, welcome to use Launchimage interface

For IOS7, Apple provides the launchimage to achieve the welcome interface, when developing only need to design the corresponding size of the picture to drag to the corresponding state location.

In IOS7, the Welcome interface corresponds to the following dimensions:

iphone vertical Screen 640*960 640*1136

ipad Vertical Screen 768*1024 1536*2048

ipad Horizontal screen 1024x768 2028*1536

IOS8 appeared, Apple launched the Launchscreen.xib to do the welcome interface, if you want to launchimage to do the welcome interface, Perfect fit IOS7 and IOS8, how should it be done?

First, you need to delete the launchscreen.xib, otherwise IOS8 will call it automatically. Then find Images.xcassets, click the + sign below, select New Launch image, and then follow the corresponding requirements to put the corresponding size picture, and the previous operation is exactly the same.

Iv. Welcome to the interface using Launchscreen.xib

Xcode6/ios8 has added many new features, such as Launchscreen.xib, Size classes, and so on. When the program starts, it automatically calls Launchscreen.xib, so you can add the controls you want to display on this xib and add constraints to display them.

As shown, the current welcome interface includes the middle of the headline, the company information below, and a picture. Because the controls above are all constraints added in the case of any W and any H, they can be fitted on any device of any size. In order to ensure a more perfect effect, xib in the picture we can use the images.xcassets to set, so that the different devices can automatically select the corresponding size of the picture, to achieve better results.

The above launchscreen.xib is automatically generated using XCODE6 to create the project, if you do not want to use auto-generated, you can also switch to other xib, but unfortunately, for the welcome interface of the Xib is not able to connect with the view controller, Therefore, only static, pre-laid interfaces can be displayed. Change xib can be replaced in two places.

Welcome to the dynamic loading of ads on the interface

There are many applications open, the Welcome screen will be loaded with a network to get the ad image or display a set of animation, how does this effect? Here is a simple way to implement loading ads.

The program runs up and the Welcome interface goes into Appdelegate, so we can do the desired effect in Application:didfinishlaunchingwithoptions: Add code. Web Capture images can be implemented with third-party sdwebimage, so you need to import third-party folders first. Because the page that displays the ad is displayed on the Welcome screen, you can use the Launchscreen.xib view to add a uiimageview display image on top of it, and then put it on the window and display it on top. After the ad image is displayed, the view is removed and the program's main screen is displayed. The code looks like this:

#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, -, the, -)]; 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:3target:self selector: @selector (Removelun) Userinfo:nil Repeats:no]; returnYES;}-(void) removelun{[Lunchview Removefromsuperview];}

iOS Welcome interface Launch screen dynamic load ad

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.