Skip to content

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

License

Notifications You must be signed in to change notification settings

bdevilleivc/LBLaunchImageAd

 
 

Repository files navigation

LBLaunchImageAd

Codewake Build Status Carthage compatible Pod Platform Pod Version Pod License

支持pod导入

pod 'LBLaunchImageAd','~> 1.0.2'

如果发现pod search LBLaunchImageAd 搜索出来的不是最新版本,需要在终端执行cd转换文件路径命令退回到desktop,然后执行pod setup命令更新本地spec缓存(可能需要几分钟),然后再搜索就可以了;也可以试下如下方法

rm ~/Library/Caches/CocoaPods/search_index.json

然后再pod search LBLaunchImageAd

2017/6/28号更新:

修复bug,修复cocopods版本不同步等问题

2017/4/1号更新:

1.优化封装调用接口

2.优化性能

ps:有什么问题可以留言,好用请star支持

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

效果图如下:

(LBLaunchImageAd)

本框架依赖SDWebImage

导入#import "NSObject+LBLaunchImage.h"

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

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

    //举个例子[LBNetWork PostAPI:url Dic:nil Suc:^(NSDictionary *Res)是自己封装的网络请求 
    [NSObject makeLBLaunchImageAdView:^(LBLaunchImageAdView *imgAdView) {
    
        [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) {
                __weak typeof(self) weakSelf = self;
                 //设置广告的类型
                imgAdView.getLBlaunchImageAdViewType(LogoAdType);
                //设置网络启动图片URL
                imgAdView.imgUrl = imgURL;
                //自定义跳过按钮
                imgAdView.skipBtn.backgroundColor = [UIColor blackColor];
                //各种点击事件的回调
                imgAdView.clickBlock = ^(clickType type){
                    switch (type) {
                        case clickAdType:{
                            NSLog(@"点击广告回调");
                            TestViewController *vc = [[TestViewController alloc]init];
                            vc.view.backgroundColor = [UIColor whiteColor];
                            [weakSelf.window.rootViewController presentViewController:vc animated:YES completion:^{

                            }];
                        }
                            break;
                        case skipAdType:
                            NSLog(@"点击跳过回调");
                            break;
                        case overtimeAdType:
                            NSLog(@"倒计时完成后的回调");
                            break;
                        default:
                            break;
                    }
                };
            }

    } Fai:^(NSURLSessionDataTask *operation) {
        
    }];
       
       
  }];
       
    

如果直接是固定的图片Url

    __weak typeof(self) weakSelf = self;
    [NSObject makeLBLaunchImageAdView:^(LBLaunchImageAdView *imgAdView) {
        //设置广告的类型
        imgAdView.getLBlaunchImageAdViewType(LogoAdType);
        imgAdView.imgUrl = @"http://www.uisheji.com/wp-content/uploads/2013/04/19/app-design-uisheji-ui-icon20121_55.jpg";
        //自定义跳过按钮
        imgAdView.skipBtn.backgroundColor = [UIColor blackColor];
        //各种点击事件的回调
        imgAdView.clickBlock = ^(clickType type){
            switch (type) {
                case clickAdType:{
                    NSLog(@"点击广告回调");
                    TestViewController *vc = [[TestViewController alloc]init];
                    vc.view.backgroundColor = [UIColor whiteColor];
                    [weakSelf.window.rootViewController presentViewController:vc animated:YES completion:^{

                    }];
                }
                    break;
                case skipAdType:
                    NSLog(@"点击跳过回调");
                    break;
                case overtimeAdType:
                    NSLog(@"倒计时完成后的回调");
                    break;
                default:
                    break;
            }
        };
       
    }];

如果是本地图片


__weak typeof(self) weakSelf = self;
    [NSObject makeLBLaunchImageAdView:^(LBLaunchImageAdView *imgAdView) {
        //设置广告的类型
        imgAdView.getLBlaunchImageAdViewType(LogoAdType);
        //设置本地启动图片
        imgAdView.localAdImgName = @"qidong.gif";
        //自定义跳过按钮
        imgAdView.skipBtn.backgroundColor = [UIColor blackColor];
        //各种点击事件的回调
        imgAdView.clickBlock = ^(clickType type){
            switch (type) {
                case clickAdType:{
                    NSLog(@"点击广告回调");
                    TestViewController *vc = [[TestViewController alloc]init];
                    vc.view.backgroundColor = [UIColor whiteColor];
                    [weakSelf.window.rootViewController presentViewController:vc animated:YES completion:^{

                    }];
                }
                    break;
                case skipAdType:
                    NSLog(@"点击跳过回调");
                    break;
                case overtimeAdType:
                    NSLog(@"倒计时完成后的回调");
                    break;
                default:
                    break;
            }
        };
       
    }];

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 95.6%
  • Shell 3.7%
  • Ruby 0.7%