FourSectionTableViewCell.m 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // FourSectionTableViewCell.m
  3. // BuguLive
  4. //
  5. // Created by fanwe2014 on 16/8/5.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "FourSectionTableViewCell.h"
  9. #import "AcutionHistoryModel.h"
  10. @implementation FourSectionTableViewCell
  11. - (void)awakeFromNib
  12. {
  13. [super awakeFromNib];
  14. //
  15. // self.lineView = [[UIView alloc]initWithFrame:CGRectMake(10, self.frame.size.height-1, kScreenW-10, 1)];
  16. // self.lineView.backgroundColor = kGrayTransparentColor1;
  17. // [self addSubview:self.lineView];
  18. self.headImgView.layer.cornerRadius = 12;
  19. self.headImgView.layer.masksToBounds = YES;
  20. self.stateLabel.frame = CGRectMake(0, 0, 37, 21);
  21. self.timeLabel.frame = CGRectMake(self.stateLabel.frame.size.width+3, 0, 97, 21);
  22. self.buttomLabel.frame = CGRectMake(kScreenW/2-137/2, 10,self.stateLabel.frame.size.width+self.stateLabel.frame.origin.x, 21);
  23. self.nameLabel.textColor = kAppGrayColor1;
  24. self.stateLabel.textColor = kAppGrayColor1;
  25. self.timeLabel.textColor = kAppGrayColor1;
  26. self.moneyLabel.textColor = kAppGrayColor1;
  27. self.lineView.backgroundColor = kAppSpaceColor4;
  28. }
  29. - (void)creatCellWithModel:(AcutionHistoryModel *)model withRow:(int)row
  30. {
  31. if (model.user_name.length < 1)
  32. {
  33. model.user_name = @"aa88";
  34. }
  35. [self.headImgView sd_setImageWithURL:[NSURL URLWithString:model.head_image]];
  36. NSMutableString *strMobile = [NSMutableString stringWithString:model.user_name];
  37. [strMobile replaceCharactersInRange:NSMakeRange(1, model.user_name.length-2) withString:@"**"];
  38. self.nameLabel.text = strMobile;
  39. NSString *moneyStr = model.pai_diamonds;
  40. if ([moneyStr integerValue] > 1000)
  41. {
  42. moneyStr = [NSString stringWithFormat:ASLocalizedString(@"%.3fK"),[moneyStr floatValue]/1000];
  43. }else
  44. {
  45. if (!moneyStr.length)
  46. {
  47. moneyStr = @"";
  48. }
  49. }
  50. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:moneyStr];
  51. [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:12.0]} range:NSMakeRange(0, moneyStr.length)];
  52. CGFloat width =[moneyStr sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]}].width;
  53. self.rightViewConstraintW.constant = width+16;
  54. self.moneyLabel.attributedText = attr;
  55. self.timeLabel.text = model.pai_time_ymd;
  56. if (row == 0)
  57. {
  58. self.nameLabel.textColor = kAppGrayColor1;
  59. self.stateLabel.backgroundColor = kAppMainColor;
  60. self.stateLabel.text = ASLocalizedString(@"领先");
  61. self.stateLabel.textColor = kWhiteColor;
  62. self.timeLabel.textColor = kAppGrayColor1;
  63. self.moneyLabel.textColor = kAppGrayColor1;
  64. }else
  65. {
  66. self.stateLabel.layer.borderWidth = 1;
  67. self.stateLabel.text = ASLocalizedString(@"出局");
  68. self.stateLabel.layer.borderColor = kAppGrayColor1.CGColor;
  69. }
  70. if (row == 2)
  71. {
  72. self.lineView.hidden = YES;
  73. }
  74. }
  75. @end