GroupSquareCell.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // GroupSquareCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/5/6.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "GroupSquareCell.h"
  9. @implementation GroupSquareCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. self.JoinBtn.layer.cornerRadius = 2.f;
  13. self.JoinBtn.layer.borderWidth = 0.5f;
  14. self.JoinBtn.layer.borderColor = UIColorHex(0x13A3FF).CGColor;
  15. self.JoinBtn.layer.masksToBounds = YES;
  16. }
  17. + (CGFloat)configCell0Height
  18. {
  19. return 60.f;
  20. }
  21. + (CGFloat)configCell1Height
  22. {
  23. return 98.f;
  24. }
  25. + (GroupSquareCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  26. static NSString *cellIdentifer = @"GroupSquareCell0";
  27. GroupSquareCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  28. if (cell == nil) {
  29. cell = [[[NSBundle mainBundle] loadNibNamed:@"GroupSquareCell" owner:nil options:nil] objectAtIndex:0];
  30. }
  31. return cell;
  32. }
  33. + (GroupSquareCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  34. static NSString *cellIdentifer = @"GroupSquareCell1";
  35. GroupSquareCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  36. if (cell == nil) {
  37. cell = [[[NSBundle mainBundle] loadNibNamed:@"GroupSquareCell" owner:nil options:nil] objectAtIndex:1];
  38. }
  39. return cell;
  40. }
  41. - (void)setLeftDataModel:(GroupSquareModel *)model
  42. {
  43. self.BlueView.hidden = !model.isSelect;
  44. if (model.isSelect) {
  45. self.NameL.textColor = UIColorHex(0x262626);
  46. self.contentView.backgroundColor = UIColorHex(0xffffff);
  47. self.NameL.font = [UIFont systemFontOfSize:15];
  48. }else{
  49. self.NameL.textColor = UIColorHex(0x333333);
  50. self.contentView.backgroundColor = UIColorHex(0xF2F2F2);
  51. self.NameL.font = [UIFont systemFontOfSize:13];
  52. }
  53. self.NameL.text = model.PiazzaName;
  54. }
  55. - (void)setRightDataSubModel:(GroupSquareSubModel *)model
  56. {
  57. [self.IconView sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:IMG(@"img_placeHolder")];
  58. self.titleL.text = model.Name;
  59. self.userCountL.text = [self userCountText:model.UserCount];
  60. self.TopicCountL.text = [NSString stringWithFormat:@"%ld",model.GroupArticleCount];
  61. self.subTitleL.text = model.Introduce;
  62. }
  63. - (NSString *)userCountText:(NSInteger)userCount
  64. {
  65. if (userCount >= 1000) {
  66. CGFloat s = userCount / 1000;
  67. return [NSString stringWithFormat:@"%.1f%@",s,@"k"];
  68. }else{
  69. return [NSString stringWithFormat:@"%ld",userCount];
  70. }
  71. }
  72. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  73. [super setSelected:selected animated:animated];
  74. // Configure the view for the selected state
  75. }
  76. @end