API 说明
下面是对内容中台 SDK 相关 API 接口的详细说明。
创建内容社区 VC
- (UIViewController *)createFeedViewController
创建内容社区 View
创建内容社区 View,并支持用户将 View 添加到自己的页面 VC 中。
- (UIScrollView *)createCubeCardFeedViewWithFrame:(CGRect)frame feedTyptene:(MPContFeedListType)type
请求参数
参数 | 类型 | 描述 |
---|---|---|
frame | CGRect | 内容社区 View 的大小 |
type | MPContentFeedListType | Feed 流的样式:
|
返回参数
参数 | 类型 | 描述 |
---|---|---|
view | UICollectionView | 创建的内容社区 View |
首页 Feed 流列表指定位置插入自定义 View
- (void)insertCustomFeedView:(UIView *)customView atIndex:(NSInteger)index toFeedViewController:(UIViewController *)feedVC;
请求参数
参数 | 类型 | 描述 |
---|---|---|
customView | UIView | 传入的自定义 View |
index | NSInteger | 插入的位置下标 |
feedVC | UIViewController | 内容社区页面 VC |
返回参数
无。
设置视频是否自动播放
默认是自动播放。
@property (nonatomic,assign) BOOL isAutoPlay;
请求参数
参数 | 类型 | 描述 |
---|---|---|
isAutoPlay | boolean | 视频是否自动播放 |
返回参数
无。
点击商品“立即购买”时回调
当 C 端用户在详情页点击购买商品时进行回调,跳到您自定义的页面。
- (void)mpContentSelectedGoodsWithItemData:(id)itemData forType:(MPContentGoodsForType)type;
请求参数
参数 | 类型 | 描述 |
---|---|---|
type | MPContentGoodsForType | 点击商品的来源:
|
itemData | NSDictionary | 点击商品的详情数据 |
itemData
字段说明:
参数 | 类型 | 描述 |
---|---|---|
productId | MPContentGoodsForType | 商品 ID |
productName | NSDictionary | 商品名称 |
pb_description | NSString | 商品描述 |
actionUrl | NSString | 跳转链接 URL |
thumbnailUrl | NSString | 缩略图 URL |
bannerUrl | NSString | Banner 链接 |
actionType | MPActionTypePB | 点击商品的事件类型:
|
extInfo | NSDictionary | 扩展数据 |
返回参数
无。
图文详情页底部传入自定义的 View
- (void)insertCustomViewForRichTextDetailWithFeedData:(id)feedData contrainerView:(UIView *)contrainerView
请求参数
参数 | 类型 | 描述 |
---|---|---|
contrainerView | UIView | 自定义 View 的父 View |
feedData | NSDictionary | 点击商品的详情数据 |
feedData
字段说明:
参数 | 类型 | 描述 |
---|---|---|
title | NSString | 标题 |
avatarUrl | NSString | 头像 |
nickName | NSString | 昵称 |
publishTime | NSString | 发布时间 |
contentText | NSString | 内容 |
readCount | Int | 观看量 |
feedId | NSString | 图文详情的唯一 ID |
publisherId | NSString | 发布者 ID |
praiseNum | Int | 点赞量 |
isPraised | BOOL | 是否点赞 |
返回参数
无。
未登录回调
点赞未登录时进行回调。用户需要在登录后才能进行点赞操作。
- (void)mpContentIsLogin:(BOOL)isLogin;
请求参数
参数 | 类型 | 描述 |
---|---|---|
isLogin | BOOL | 点赞时检测到当前用户未登录,可在此回调中进行用户登录,成功后设置用户的 |
返回参数
无。