CommentEmoji.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // CommentEmoji.m
  3. // BuguLive
  4. //
  5. // Created by 朱庆彬 on 2017/8/15.
  6. // Copyright © 2017年 xfg. All rights reserved.
  7. //
  8. #import "CommentEmoji.h"
  9. @implementation CommentEmoji
  10. + (NSArray *)emojiObjsWithPage:(NSInteger)page
  11. {
  12. if (page > [[self class] pageCountIsSupport])
  13. {
  14. return @[];
  15. }
  16. NSMutableArray *array_common_s = [NSMutableArray array];
  17. NSInteger count_line = [[self class] countInOneLine];
  18. NSInteger start_count = (count_line * EmojiIMG_Lines - 1) * page;
  19. NSInteger end_count = MIN([ChatEmojiIcons getEmojiPopCount], start_count + (count_line * EmojiIMG_Lines - 1));
  20. for (int tag = (int) start_count; tag < end_count; tag++)
  21. {
  22. CommentEmoji *obj = [CommentEmoji new];
  23. obj.emojiImgName = [NSString stringWithFormat:@"face.bundle/%@", [ChatEmojiIcons getEmojiPopIMGNameByTag:tag]];
  24. obj.emojiName = [NSString stringWithFormat:@"face.bundle/%@", [ChatEmojiIcons getEmojiPopNameByTag:tag]];
  25. obj.emojiString = [NSString stringWithFormat:@"face.bundle/%@", [ChatEmojiIcons getEmojiNameByTag:tag]];
  26. [array_common_s addObject:obj];
  27. }
  28. [array_common_s addObject:[[self class] del_Obj]];
  29. return array_common_s;
  30. }
  31. + (NSInteger)pageCountIsSupport
  32. {
  33. NSInteger count_all = [ChatEmojiIcons getEmojiPopCount];
  34. NSInteger page_one = [[self class] onePageCount];
  35. return (count_all / page_one) + ((int) ((count_all % page_one) != 0));
  36. }
  37. @end