Coder Social home page Coder Social logo

feihuohua / jwlaunchad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jwxian/jwlaunchad

0.0 2.0 0.0 5.32 MB

一行代码集成启动页广告,同时支持Storyboard和LaunchImage,支持Gif,自带图片下载缓冲,无负担集成.

License: Apache License 2.0

Ruby 1.73% Objective-C 98.27%

jwlaunchad's Introduction

image

License MIT  Support CocoaPods  AppVeyor

Demo Project

image image image

API

/**
 *  初始化启动页
 *
 *  @param adDuration  停留时间
 *  @param hideSkip    是否隐藏跳过
 *  @param setLaunchAd launchAdView
 *
 *  @return self
 */
+ (instancetype)initImageWithAttribute:(NSInteger)adDuration showSkipType:(SkipShowType)showSkipType setLaunchAd:(JWSetLaunchAdBlock)setLaunchAd;

/**
 *  设置图片
 *
 *  @param strURL       URL
 *  @param options      图片缓冲模式
 *  @param result       UIImage *image, NSURL *url
 *  @param adClickBlock 点击图片回调
 */
- (void)setWebImageWithURL:(NSString *)strURL options:(JWWebImageOptions)options result:(JWWebImageCompletionBlock)result adClickBlock:(JWLaunchAdClickBlock)adClickBlock;

/**
*  设置动画跳过属性
*
*  @param strokeColor     转动颜色
*  @param lineWidth       宽度
*  @param backgroundColor 背景色
*  @param textColor       字体颜色
*/
- (void)setAnimationSkipWithAttribute:(UIColor *)strokeColor lineWidth:(NSInteger)lineWidth backgroundColor:(UIColor *)backgroundColor textColor:(UIColor *)textColor;

/**
 *  广告图Frame
 */
@property (assign, nonatomic) CGRect launchAdViewFrame;

Usage

  • 在AppDelegate中设置Window.rootViewController之后调用下面方法
//  1.设置启动页广告图片的URL
NSString *imgUrlString =@"http://imgstore.cdn.sogou.com/app/a/100540002/714860.jpg";
    
//  2.初始化启动页
[JWLaunchAd initImageWithAttribute:6.0 showSkipType:SkipShowTypeAnimation setLaunchAd:^(JWLaunchAd *launchAd) {
    __block JWLaunchAd *weakSelf = launchAd;
    //如果选择 SkipShowTypeAnimation 需要设置动画跳过按钮的属性
    [weakSelf setAnimationSkipWithAttribute:[UIColor redColor] lineWidth:3.0 backgroundColor:nil textColor:nil];

    [launchAd setWebImageWithURL:imgUrlString options:JWWebImageDefault result:^(UIImage *image, NSURL *url) {

        //  异步缓冲图片完成后调整图片Frame
        weakSelf.launchAdViewFrame = CGRectMake(0, 0, kScreen_Width, kScreen_Height-100);
    } adClickBlock:^{

        //  3.广告回调  
        NSString *url = @"https://www.baidu.com";
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
    }];
}];

Installation

CocoaPods

  1. Add pod 'JWLaunchAd' to your Podfile.
  2. Run pod install or pod update.
  3. Import JWLaunchAd.h.

Manually

  1. Add the source files to your Xcode project.
  2. Import JWLaunchAd.h.

Requirements

This library requires iOS 7.0+ .

License

JWLaunchAd is provided under the MIT license. See LICENSE file for details.

jwlaunchad's People

Contributors

jwxian avatar jwxi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.