自定义广告接入代码

1. 包含头文件

#import <AdHubSDK/AdHubSDK.h>

2. 自定义的创建和初始化

// 自定义广告的创建和初始化
self.custom = [[AdHubCustomView alloc] initWithSpaceID:[DemoIDData sharedInstance].customSpaceID spaceParam:[DemoIDData sharedInstance].customSpaceParam];
self.custom.frame = CGRectZero;
self.custom.delegate = self;
// 自定义广告请求开始
[self.custom loadAd];

3. 主要属性说明

//广告位 id 在AdHub后台创建产生
@property(nonatomic, readonly, copy) NSString *spaceID;
//填写任意字符串
@property(nonatomic, readonly, copy) NSString *spaceParam;

/**
 用来接收自定义广告读取和展示状态变化通知的 delegate
 */
@property(nonatomic, weak) id<AdHubCustomViewDelegate> delegate;

4. 代理方法说明

@required
/**
 @return 展现自定义广告点击二跳所需的 UIViewController,不能为空
 */
- (UIViewController *)adCustomViewControllerForPresentingModalView;

@optional
/**
 自定义广告加载成功
 */
- (void)adCustomViewDidReceiveAd:(AdHubCustomView *)customView;

/**
 自定义广告加载失败
 */
- (void)adCustomView:(AdHubCustomView *)customView didFailToReceiveAdWithError:(AdHubRequestError *)error;

/**
 自定义广告关闭
 点击广告, 手动调用 customCloseAd 会移除当前广告展示
 */
- (void)adCustomViewDidDismissScreen:(AdHubCustomView *)customView;

/**
 自定义广告点击 landingPageURL 为空时说明有详情页
 */
- (void)customDidClick:(NSString *)landingPageURL;

results matching ""

    No results matching ""