横幅样式接入说明
横幅样式的示例效果
横幅的使用介绍
在对应的文件中#import "MMUBanners.h" (确认对应的.a文件也已经引入工程)。
MMUBanners的创建和初始化:
//横幅的创建和初始化 self.banners = [[MMUBanners alloc] initWithSlotId:@"Your slot ID" bannersDelegate:self browserDelegate:self positionType:PositionTypeDown_middle]; [self.view addSubview:_banners]; //创意请求开始 [_banners requestBannerAd];
MMUBanners主要属性说明:
//横幅对象的代理 @property (nonatomic, weak, readonly) id<MMUBannersDelegate> delegate; //点击横幅弹出界面的行为代理 @property (nonatomic, weak, readonly) id<MMUBrowserDelegate> browserDelegate; //标签信息,SDK会将信息传给AFP服务器,一般用于辅助创意定向。 @property (nonatomic, copy) NSString *mTags; //用于设置在当前设备上期望的banner宽度,设置该属性后,将按照此宽度等比计算banner的高度, //默认为-1,即不对banner的宽高做等比适配(支持该特性平台:阿里妈妈) @property (nonatomic, assign) float mPreferredWidth;
MMUBannersDelegate的方法说明:
@protocol MMUBannersDelegate <NSObject> @required //返回视图控制器,此代理方法必须实现。 - (UIViewController *)bannerViewControllerForPresentingModalView; @optional // 横幅请求成功的回调 - (void)bannerAdsSuccess:(MMUBanners *)bannerAds; // 横幅请求失败的回调 - (void)bannerAdsAllAdFail:(MMUBanners *)bannerAds withError:(NSError *)err; // 横幅展现的回调 - (void)bannerAdsAppear:(MMUBanners *)bannerAds; // 横幅点击的回调 - (void)bannerClick:(MMUBanners *)bannerAds; // 横幅关闭按钮点击的回调 - (void)bannerClosed:(MMUBanners *)bannerAds; // 开发者实现该代理方法,返回YES表示横幅关闭的行为由开发者完成 //返回NO,表示关闭行为由SDK默认处理 - (BOOL)dealCloseAd:(MMUBanners *)bannerAds;
更多关于横幅的使用请参考随SDK发布的DEMO,横幅隐藏接口请参考平台适配和自定义平台中平台适配的相关说明。