GithubHelp home page GithubHelp logo

lihuiyao1986 / lblaunchimagead Goto Github PK

View Code? Open in Web Editor NEW

This project forked from allluckly/lblaunchimagead

0.0 2.0 0.0 3.36 MB

iOS开发启动广告,动态获取网络启动图片,具有渐变的启动动画,支持半屏和全屏,类似百度ssp广告和广点通的广告。支持广告点击等,集成非常的方便。欢迎使用,好用请star

Home Page: https://blog.allluckly.cn

License: MIT License

Ruby 0.35% Objective-C 99.65%

lblaunchimagead's Introduction

LBLaunchImageAd

Codewake Build Status Carthage compatible

##技术交流群:534926022(免费) 511040024(0.8/人付费)

###iOS开发学习app下载

###实现原理介绍

效果图如下:

(LBLaunchImageAd)

本框架依赖SDWebImage

导入LBLaunchImageAd

AppDelegate.mdidFinishLaunchingWithOptions方法中复制如下代码即可

如果需要网络请求得到URL的例子如下

    //初始化一个adView
    LBLaunchImageAdView * adView = [[LBLaunchImageAdView alloc]initWithWindow:self.window adType:LogoAdType];
    //举个例子[LBNetWork PostAPI:url Dic:nil Suc:^(NSDictionary *Res)是自己封装的网络请求    
    [LBNetWork PostAPI:url Dic:nil Suc:^(NSDictionary *Res) {

        NSArray *arr = Res[@"resultContent"];
        NSString *imgURL = nil;
        for (NSDictionary *dic in arr) {
            imgURL = [NSString stringWithFormat:@"xxxxx%@",dic[@"imgpath"]] ;
        }
        //关键地方
        if (imgURL) {
            adView.imgUrl = imgURL;
            //各种回调
            adView.clickBlock = ^(NSInteger tag){
                switch (tag) {
                    case 1100:{
                        
                    }
                        break;
                    case 1101:
                        NSLog(@"点击跳过回调");
                        self.window.rootViewController = _tabBarController;
                        break;
                    case 1102:
                        NSLog(@"倒计时完成后的回调");
                        self.window.rootViewController = _tabBarController;
                        break;
                    default:
                        break;
                }
                
            };
        }
        
        
    } Fai:^(NSURLSessionDataTask *operation) {
        
    }];

如果直接是固定的图片Url

    LBLaunchImageAdView * adView = [[LBLaunchImageAdView alloc]initWithWindow:self.window adType:LogoAdType];
    adView.imgUrl = @"http://www.uisheji.com/wp-content/uploads/2013/04/19/app-design-uisheji-ui-icon20121_55.jpg";
    adView.clickBlock = ^(NSInteger tag){
        switch (tag) {
            case 1100:{
                
            }
                break;
            case 1101:
                NSLog(@"点击跳过回调");
                self.window.rootViewController = _tabBarController;
                break;
            case 1102:
                NSLog(@"倒计时完成后的回调");
                self.window.rootViewController = _tabBarController;
                break;
            default:
                break;
        }
                    
    };

如果是本地图片


LBLaunchImageAdView * adView = [[LBLaunchImageAdView alloc]initWithWindow:self.window adType:FullScreenAdType];
adView.localAdImgName = @"qidong.png"; 
//各种回调
adView.clickBlock = ^(NSInteger tag){
    switch (tag) {
        case 1100:{
            NSLog(@"点击广告回调");
            TestViewController *vc = [[TestViewController alloc]init];
            vc.view.backgroundColor = [UIColor whiteColor];
            [self.window.rootViewController presentViewController:vc animated:YES completion:^{
                
            }];
        }
            break;
        case 1101:
            NSLog(@"点击跳过回调");
            break;
        case 1102:
            NSLog(@"倒计时完成后的回调");
            break;
        default:
            break;
    }
    
};

lblaunchimagead's People

Contributors

sobison avatar allluckly 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.