iOS Welcome interface Launch screen dynamic load ad

Source: Internet
Author: User

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, 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];}

iOS Welcome Interface Launch screen dynamic load ads

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.