信息流样式接入说明
信息流样式的示例效果
信息流的使用介绍
信息流的接入方式分为SDK渲染和SDK-数据接口两种方式
SDK渲染接入方式的使用
在对应的文件中#import MMUFeeds.h” (确认对应的.a文件也已经引入工程)
MMUFeeds的创建和初始化示例代码:
self.feedsManager = [[MMUFeeds alloc] initWithSlotId:@"52830254" viewController:self]; self.feedsManager.delegate = (id<MMUFeedsDelegate>)self; self.feedsManager.browserDelegate = (id<MMUBrowserDelegate>)self; //mAdcnt期望返回的创意数 _feedsManager.mAdcnt = 3; [self.feedsManager requestPromoterDataInBackground];
MMUFeeds的属性介绍:
//信息流对象的代理 @property (nonatomic, weak) id<MMUFeedsDelegate> delegate; //点击信息流创意弹出界面的行为代理 @property (nonatomic, weak) id<MMUBrowserDelegate> browserDelegate; //设置创意Cell的UIEdgeInsets @property (nonatomic) UIEdgeInsets mContentInsetForPromoterCell; //标签信息,SDK会将信息传给AFP服务器,一般用于辅助创意定向。 @property (nonatomic, copy) NSString *mTags; //表示创意是否ready @property (nonatomic, readonly) BOOL mReadyToShown; // 设置推广位的实际大小(in point):推广位宽度x推广位高度,如 320x100 @property (nonatomic, copy) NSString *mSize; //期望返回的创意条数 @property (nonatomic) NSInteger mAdcnt;
MMUFeeds的属性介绍:
//创意加载成功回调 - (void)feeds:(MMUFeeds *)feeds didLoadDataFinished:(NSInteger)promotersAmount; //创意加载失败回调 - (void)feeds:(MMUFeeds *)feeds didLoadDataFailedWithError:(NSError *)error; //创意点击回调 - (void)feeds:(MMUFeeds *)feeds didClickedPromoterAtIndex:(NSInteger)promoterIndex; //创意更新回调 - (void)feeds:(MMUFeeds *)feeds didUpdatedToPromoters:(NSInteger)newPromotersAmount;
详细的使用方法请参考随着SDK一起发布的DEMO工程中信息流部分的示例(FeedShowController.m)。
SDK-数据接口接入方式的使用
SDK-数据接口形式的信息流需要#import “MMUNativePromoterManager.h”,并且初始化方法的layoutType参数传入MMULayoutTypeFeeds表示样式是信息流,示例代码:
_mPromoterManager = [[MMUNativePromoterManager alloc] initWithSlotId:@"Your slot ID" layoutType:MMULayoutTypeFeeds]; _mPromoterManager.delegate = (id<MMUNativePromoterManagerDelegate>)self; [_mPromoterManager requestPromoterDataInBackground];
关于MMUNativePromoterManager的使用,参见SDK-数据接口使用说明。详细的使用方式请参考随着SDK一起发布的DEMO工程中信息流-数据接口1(FeedsDemo_DI.m)部分的示例。
注意:对于百度平台的信息流的展现上报需要百度自己的view,所以百度信息流的使用和其他平台是不一样的,它的使用方式请参考随着SDK一起发布的DEMO工程中信息流-数据接口2(FeedNative_DI.m)部分的示例。