PriceCell.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // PriceCell.m
  3. // JSJPCoach
  4. //
  5. // Created by apple on 2017/3/27.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "PriceCell.h"
  9. @implementation PriceCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. -(void)setPriceDic:(NSDictionary *)priceDic
  14. {
  15. _priceDic = priceDic;
  16. NSString *strSD = @"";
  17. switch ([priceDic[@"CSI_TRAINNINGTIME"] integerValue]) {
  18. case 0:
  19. strSD = @"全时段";
  20. break;
  21. case 1:
  22. strSD = @"普通时段";
  23. break;
  24. case 2:
  25. strSD = @"高峰时段";
  26. break;
  27. case 3:
  28. strSD = @"节假日";
  29. break;
  30. default:
  31. break;
  32. }
  33. NSString *priceString = [NSString stringWithFormat:@"%@元/时",priceDic[@"CSI_PRICE"]];
  34. if ([priceString containsString:@"免费"]) {
  35. priceString = @"免费";
  36. }
  37. [_carTypeLabel setText:priceDic[@"CSI_VEHICLETYPE"] Font:Font16 TextColor:newTitleColor Alignment:NSTextAlignmentLeft];
  38. [_priceLabel setText:priceString Font:Font16 TextColor:newTitleColor Alignment:NSTextAlignmentLeft];
  39. [_timeLabel setText:strSD Font:Font16 TextColor:newTitleColor Alignment:NSTextAlignmentLeft];
  40. }
  41. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  42. [super setSelected:selected animated:animated];
  43. self.contentView.backgroundColor = selected ? [UIColor colorWithWhite:0 alpha:0.2] : [UIColor clearColor];
  44. }
  45. @end