添加二级评论多个的时候的逻辑,默认每次点击出现5条
This commit is contained in:
@@ -64,19 +64,29 @@
|
||||
return KBAIReplyFooterStateHidden;
|
||||
}
|
||||
|
||||
// 已展开
|
||||
if (self.isRepliesExpanded) {
|
||||
return KBAIReplyFooterStateCollapse;
|
||||
// 未展开(初始状态)
|
||||
if (!self.isRepliesExpanded) {
|
||||
return KBAIReplyFooterStateExpand;
|
||||
}
|
||||
|
||||
// 未展开
|
||||
return KBAIReplyFooterStateExpand;
|
||||
// 已展开但还有更多
|
||||
if (self.displayedReplies.count < self.totalReplyCount) {
|
||||
return KBAIReplyFooterStateLoadMore;
|
||||
}
|
||||
|
||||
// 全部展开
|
||||
return KBAIReplyFooterStateCollapse;
|
||||
}
|
||||
|
||||
- (void)expandAllReplies {
|
||||
- (void)loadMoreReplies:(NSInteger)count {
|
||||
self.isRepliesExpanded = YES;
|
||||
[self.displayedReplies removeAllObjects];
|
||||
[self.displayedReplies addObjectsFromArray:self.replies];
|
||||
|
||||
NSInteger currentCount = self.displayedReplies.count;
|
||||
NSInteger endIndex = MIN(currentCount + count, self.replies.count);
|
||||
|
||||
for (NSInteger i = currentCount; i < endIndex; i++) {
|
||||
[self.displayedReplies addObject:self.replies[i]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)collapseReplies {
|
||||
|
||||
Reference in New Issue
Block a user