Banner广告接入代码

1. 包含头文件

#import <AdHubSDK/AdHubSDK.h>

2. 横幅广告的创建和初始化

// Banner 的创建和初始化
self.banner = [[AdHubBannerView alloc] initWithSpaceID:[DemoIDData sharedInstance].bannerSpaceID spaceParam:[DemoIDData sharedInstance].bannerSpaceParam];
self.banner.delegate = self;
// Banner 请求开始
[self.banner loadAd];

3. 主要属性说明

//广告位 id 在AdHub后台创建产生
@property(nonatomic, readonly, copy) NSString *spaceID;
//填写任意字符串
@property(nonatomic, readonly, copy) NSString *spaceParam;
/**
 用来接收 Banner 广告读取和展示状态变化通知的 delegate
 */
@property(nonatomic, weak) id<AdHubBannerViewDelegate> delegate;

4. 代理方法说明

@required
/**
 @return 展现 Banner 点击二跳所需的 UIViewController,不能为空
 */
- (UIViewController *)adBannerViewControllerForPresentingModalView;

@optional
// Banner 加载成功
- (void)adViewDidReceiveAd:(AdHubBannerView *)bannerView;

// Banner 加载失败
- (void)adView:(AdHubBannerView *)bannerView didFailToReceiveAdWithError:(AdHubRequestError *)error;

// Banner 即将展现
- (void)adViewWillPresentScreen:(AdHubBannerView *)bannerView;

// Banner 点击 landingPageURL 为空时说明有详情页
- (void)adViewClicked:(NSString *)landingPageURL;

// Banner 关闭
- (void)adViewDidDismissScreen:(AdHubBannerView *)bannerView;

results matching ""

    No results matching ""