Skip to main content

原生拼接开屏

一、简介#

主要介绍在iOS项目中如何集成 TradPlus SDK的原生拼接开屏广告:

> 原生拼接开屏

  • 基于原生广告拼接开屏
  • 创建广告位时,样式选择选择原生广告,模版选择原生拼接开屏。
  • 如果三方提供的是模版类型的广告,不支持调整素材的位置。

二、集成说明#

// 初始化广告位,仅调用一次。_placementId是在TradPlus后台创建的广告位。
self.splashAdView = [[TPNativeSplashAdView alloc] initWithPlacementId:_placementId frame:self.view.frame];
// 设置delegate
self.splashAdView.delegate = self;
// 请求广告。
[self.splashAdView loadAd];
// 展示广告
[self.splashAdView showInWindow:[UIApplication sharedApplication].keyWindow];
//处理回调
//触发开屏的UIViewController
- (UIViewController *)viewControllerForPresentingModalView
{
return self;
}
//开屏加载成功
- (void)splashAdViewLoaded:(TPNativeSplashAdView *)splashAdView
{
}
//开屏加载失败
- (void)splashAdView:(TPNativeSplashAdView *)splashAdView didFailWithError:(NSError *)error
{
dispatch_async(dispatch_get_main_queue(), ^{
[self.activityIndicatorView stopAnimating];
});
}
//点击了右上角的跳过按钮
- (void)splashAdViewSkip:(TPNativeSplashAdView *)splashAdView
{
[self.splashAdView removeFromSuperview];
}
//开屏广告关闭
- (void)splashAdViewDismissed:(TPNativeSplashAdView *)splashAdView
{
[self.splashAdView removeFromSuperview];
}
//开屏广告点击
- (void)splashAdViewClicked:(TPNativeSplashAdView *)splashAdView
{
[self.splashAdView removeFromSuperview];
}
//竞价开始
- (void)splashAdViewBidStart:(TPNativeSplashAdView *)splashAdView
{
}
//竞价结束
- (void)splashAdViewBidEnd:(TPNativeSplashAdView *)splashAdView
{
}
//加载三方源开始
- (void)splashAdViewLoadStart:(TPNativeSplashAdView *)splashAdView
{
}
//整个广告位加载结束
- (void)splashAdViewAllLoaded:(TPNativeSplashAdView *)splashAdView
{
}