IOS launch page advertisement XHLaunchAd, ios advertisement xhlaunchad

Source: Internet
Author: User

IOS launch page advertisement XHLaunchAd, ios advertisement xhlaunchad

IOS launch page advertisement XHLaunchAd

I. Preface:

1. Now more and more apps are inserting advertisements at startup. Because they are often used in projects, they specially write a library called XHLaunchAd.
2. demo address: webpage link
3. Only a few lines of simple code can be used to import the library to enable static/dynamic advertisement on the startup page.
4. This project has received more than 400 stars since it was released two months ago. It has been updated to V2.1.4 and is now shared with you.

-> XHLaunchAd (2.1.3)
Several lines of code are used to access the launch page advertisement, which includes image download and cache functions without any third-party dependency. It supports static/dynamic, full-screen/half-screen advertisements,
Supports LaunchImage or LaunchScreen.
Pod 'hlaunchad', '~> 2.1.4'
-Homepage: https://github.com/CoderZhuXH/XHLaunchAd
-Source: https://github.com/CoderZhuXH/XHLaunchAd.git
-Versions: 2.1.4, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.0.1, 2.0, 1.2, 1.1.4, 1.1.3, 1.1.2,
1.1, 1.0 [master repo]
Iii. XHLalunchAd features:
  • 1. Supports full-screen/half-screen advertisements.

  • 2. Supports static and dynamic advertisements.

  • 3. supports ad click events.

  • 4. built-in image download and cache functions.

  • 5. No dependency on other third-party frameworks.

  • 6. No advertisement data is detected and the start time of the page can be set.

  • 7. The launch page is either LaunchImage or LaunchScreen. storyboard.

4. API:
  • It mainly provides two APIs, which are very simple to call.

  • 1. Initialization Method

/**
* Display the launch Advertisement
*
* @ Param frame ad frame
* @ Param setAdImage sets AdImage callback
* @ Param showFinish: callback for AD display completion
*/
+ (Void) showWithAdFrame: (CGRect) frame setAdImage: (setAdImageBlock) setAdImage showFinish: (showFinishBlock) showFinish;
  • 2. Data Source Method

/**
* Set AD data
*
* @ Param imageUrl: image url
* @ Param duration ad stop time
* @ Param skipType skip button type
* @ Param options: Image caching mechanism
* @ Param completedBlock: callback after the image is asynchronously loaded
* @ Param click callback of the AD click Event
*/
-(Void) setImageUrl: (NSString *) imageUrl duration: (NSInteger) duration skipType: (SkipType) skipType options: (XHWebImageOptions) options completed: (optional) completedBlock click: (clickBlock) click;
5. call:
  • Import the XHLaunchAd. h header file in AppDelegate and call the initialization method and Data Source Method in didfinishlaunchingwitexceptions: as follows:

// 1.-> display the launch advertisement (initialization method)
[XHLaunchAd showWithAdFrame: Ad frame size setAdImage: ^ (XHLaunchAd * launchAd ){

// No advertisement data is detected. The start time of the page is 3 by default. (set 4 to indicate that the start page shows 4 s and no advertisement data is detected, automatically enters the window root controller)
// LaunchAd. noDataDuration = 4;

// 2.-> set AD data (data source method)
[LaunchAd setImageUrl: Ad image URL link duration: stay time skipType: Skip button type options: cache mechanism completed: ^ (UIImage * image, NSURL * url ){

// Asynchronous image loading callback. If you need to refresh the ad frame based on the image size, you can perform this operation here.
// LaunchAd. adFrame = ...;

} Click: ^ {

// Ad Click Event
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: Ad click jump link];

}];

} ShowFinish: ^ {

// Callback for AD display completion, set the window root Controller
Self. window. rootViewController = [[UINavigationController alloc] initWithRootViewController: [[UIViewController alloc] init];

}];

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.