DistributionCell.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // DistributionCell.m
  3. // BuguLive
  4. //
  5. // Created by fanwe2014 on 2016/12/27.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "DistributionCell.h"
  9. #import "LiveDataModel.h"
  10. @implementation DistributionCell
  11. - (void)awakeFromNib
  12. {
  13. [super awakeFromNib];
  14. _BuguLive = [GlobalVariables sharedInstance];
  15. self.headImgView.layer.cornerRadius = 20;
  16. self.headImgView.layer.masksToBounds = YES;
  17. self.nameLabel.textColor = kAppGrayColor1;
  18. self.ticketLabel.textColor = kAppGrayColor1;
  19. self.lineView.backgroundColor = kAppSpaceColor4;
  20. }
  21. - (void)setCellWithModel:(LiveDataModel *)model
  22. {
  23. [self.headImgView sd_setImageWithURL:[NSURL URLWithString:model.head_image]];
  24. NSString *nameString;
  25. if (model.user_name.length < 1)
  26. {
  27. nameString = ASLocalizedString(@"暂时还未命名");
  28. }else
  29. {
  30. nameString = model.user_name;
  31. }
  32. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:nameString];
  33. self.nameLabel.attributedText = attr;
  34. if (model.diamonds > 1000)
  35. {
  36. self.ticketLabel.text = [NSString stringWithFormat:ASLocalizedString(@"%.2fK%@"),model.diamonds,_BuguLive.appModel.diamond_name];
  37. }else
  38. {
  39. self.ticketLabel.text = [NSString stringWithFormat:@"%.2f%@",model.diamonds ,_BuguLive.appModel.diamond_name];
  40. }
  41. }
  42. @end