投票开始的事件回调
- (void)onVoteNew:(TFVoteData*_Nullable)result
投票结束的事件回调
- (void)onVotePub:(TFVoteData*_Nullable)result
获取投票列表
- (void)getVotingList:(void (^__nullable)(NSInteger code ,NSMutableArray _Nullable list ,TFError _Nullable error))callback
调用示例:
[self.talkfunSDK getVotingList:^(NSInteger code,NSMutableArray<TFVoteData *> *list, TFError *error) {
if (code == 0 ) {
}else{
}
}];
获取投票ID详情
- (void)getVotingDetails:(NSString_Nullable)vid callback:(void (^\_nullable)(NSInteger code , TFVoteData __Nullable model,TFError *_Nullable error))callback
调用示例:
[self.talkfunSDK getVotingDetails:model.vid callback:^(NSInteger code, TFVoteData *model, TFError * _Nullable error) {
if (code == 0 ) {
}else{
}
}];
确认投票
- (void)voteSubmit:(TFSubmit_Nullable)model callback:(void (^\_nullable)(NSInteger code , TFError __Nullable error))callback
调用示例:
TFSubmit *model = [[TFSubmit alloc]init];
model.vid = self.voteView.scrollView.result.vid;
[self.talkfunSDK voteSubmit:model callback:^(NSInteger code, TFError * _Nullable error) {
if (code == 0) {
}else{
}
}];
-------------------------------------------------------------下面的代码为过期的方法,不建议使用-------------------------------------------------------------
投票开始: TALKFUN_EVENT_VOTE_NEW
@参数说明:
参数 |
类型 |
描述 |
vid |
NSString |
投票ID |
optional |
NSNumber |
可选项数 |
opList |
NSArray |
选项列表 |
info |
NSDictionary |
投票发起信息 |
info 的主要参数说明
参数 |
类型 |
描述 |
title |
NSString |
不是图片投票时候的标题 |
label |
NSString |
图片投票时候的标题 |
imageUrl |
NSString |
图片地址(区分是否是图片投票、有值则为图片投票) |
startTime |
NSString |
投票发起时间 |
调用示例:
[self.talkfunSDK on:TALKFUN_EVENT_VOTE_NEW callback:^(id obj) {
//返回数据
{
opList = ( "发", "个", "好", );
info = {
answer = "";
nickname = "江如彬";
role = "spadmin";
title = "是的是的是的";
noticeTime = "16:08";
imageUrl = "";
label = "是的 ";
xid = 1185152;
startTime = "2017-03-31 16:08:13";
gid = 0;
};
vid = "18910";
optional = 1;
}
}];
投票结束: TALKFUN_EVENT_VOTE_PUB
@参数说明:
参数 |
类型 |
描述 |
info |
NSDictonary |
被结束的投票的信息 |
statsList |
NSArray |
选项信息 |
isShow |
NSNumber |
是否公开结果 |
statsList说明:
参数 |
类型 |
描述 |
op |
NSString |
选项名 |
opNum |
NSNumber |
选择数 |
percent |
NSNumber |
百分比 |
调用示例:
[self.talkfunSDK on:TALKFUN_EVENT_VOTE_PUB callback:^(id obj) {
//返回数据
{
info = {
bid = 12526;
endTime = "2016-03-04 18:41:06";
label = 1;
nickname = "\U5146\U80fd";
noticeTime = "18:40";
optional = 1;
owner = 1;
startTime = "03-04 18:40";
status = 2;
title = 1;
uid = "zb_12526";
vid = 12649;
};
isShow = 1;
statsList = (
{
op = 213;
opNum = 0;
percent = 0;
},
{
op = 5646;
opNum = 0;
percent = 0;
},
{
op = 879;
opNum = 0;
percent = 0;
}
);
}
}];
获取全部投票
调用示例:
[self.talkfunSDK getVotes:^(id result) {
if ([result isKindOfClass:[NSArray class]]) {
//弹第0个投票
dispatch_async(dispatch_get_main_queue(), ^{
NSMutableArray *array = result;
if (array.count>0) {
[weakSelf voteNew: result[0]];
}
});
}
}];
获取未收到的投票
调用示例:
[self.talkfunSDK getVotesUnreceived:^(id result) {
if ([result isKindOfClass:[NSArray class]]) {
dispatch_async(dispatch_get_main_queue(), ^{
NSMutableArray *array = result;
if (array.count>0) {
[weakSelf voteNew: result[0]];
}
});
}
}];