项目介绍:
LBLaunchImageAd
iOS开发启动广告,动态获取网络启动图片,具有渐变的启动动画,支持半屏和全屏,类似百度ssp广告和广点通的广告。支持广告点击等,集成非常的方便。
本框架依赖SDWebImage
导入LBLaunchImageAd
在AppDelegate.m的didFinishLaunchingWithOptions方法中复制如下代码即可
如果需要网络请求得到URL的例子如下[Objective-C] 查看源文件 复制代码
LBLaunchImageAdView * adView = [[LBLaunchImageAdView alloc]initWithWindow:self.window adType:LogoAdType]; [LBNetWork PostAPI:url Dic:nil Suc:^(NSDictionary *Res) { NSArray *arr = Res[@"resultContent"]; NSString *imgURL = nil; for (NSDictionary *dic in arr) { imgURL = [NSString stringWithFormat:@"http://111.1.1.7:8088/newWisdomminshengFv/%@",dic[@"imgpath"]] ; } if (imgURL) { 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; } }; } } Fai:^(NSURLSessionDataTask *operation) { }];
如果直接是固定的图片Url[Objective-C] 查看源文件 复制代码
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; } };
如果是本地图片[Objective-C] 查看源文件 复制代码
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; } };
DEMO 直接下载: