Code Monkey home page Code Monkey logo

launchad's Introduction

LaunchAD

两行代码添加iOS应用启动广告的功能,代码可添加到任意地方,支持无网络显示,可点击进入广告页面。

广告思路:第一次进入app时没有广告(因为广告的加载最好是从本地缓存获取,如果每次都从网络获取有可能因网速原因加载失败)。第一次启动的同时,根据后台返回的数据加载广告(一般是图片地址和广告链接),然后保存在本地。第二次启动的时候本地存在了广告,这个时候就可以显示了。然后请求最新的广告数据,如果和旧广告一样则不做操作;如果有新广告,则删除本地的旧广告,保存新广告,下次启动再显示。

image
使用方法: 在使用的地方导入头文件ADView.h之后,添加如下代码

NSString *image = @"http://img5q.duitang.com/uploads/item/201505/25/20150525223238_NdQrh.thumb.700_0.png";
NSString *ad = @"http://tieba.baidu.com/";

//1、创建广告
ADView *adView = [[ADView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds imgUrl:image adUrl:ad clickImg:^(NSString *clikImgUrl) {
    NSLog(@"进入广告:%@",clikImgUrl);
}];
//2、显示广告
[adView show];

launchad's People

Contributors

xiongoahc avatar

Watchers

 avatar  avatar

Forkers

zhlove

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.