CarCell.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // CarCell.m
  3. // jiaPeiC
  4. //
  5. // Created by apple on 15/12/23.
  6. // Copyright © 2015年 JCZ. All rights reserved.
  7. //
  8. #import "CarCell.h"
  9. @implementation CarCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  14. [super setSelected:selected animated:animated];
  15. }
  16. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  17. {
  18. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  19. if (self) {
  20. UILabel* label;
  21. lblCtype = label;
  22. label = [UILabel new];
  23. [self addSubview:label];
  24. lblCtype = label;
  25. label = [UILabel new];
  26. [self addSubview:label];
  27. lblSname = label;
  28. label = [UILabel new];
  29. [self addSubview:label];
  30. titSname = label;
  31. CGFloat font = Font16;
  32. [self.textLabel setFont:[UIFont scaleSize:font]];
  33. [self.detailTextLabel setFont:[UIFont scaleSize:font]];
  34. [lblSname setFont:[UIFont scaleSize:font]];
  35. [lblCtype setFont:[UIFont scaleSize:font]];
  36. [self.textLabel setTextColor:contentTextColor];
  37. [self.detailTextLabel setTextColor:contentTextColor];
  38. [lblSname setTextColor:contentTextColor];
  39. [lblCtype setTextColor:contentTextColor];
  40. // [titSname setTextColor:contentTextColor];
  41. }
  42. return self;
  43. }
  44. +(id)cellForTabelView:(UITableView *)tableView
  45. {
  46. id cell = [tableView dequeueReusableCellWithIdentifier:@"CarCell"];
  47. if (!cell) {
  48. cell = [[CarCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"CarCell"];
  49. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  50. }
  51. return cell;
  52. }
  53. -(void)setModel:(NSDictionary *)model
  54. {
  55. [self.textLabel setText:[@"车牌号码:" stringByAppendingString:model[@"CI_CAR_NUM"]]];
  56. [self.detailTextLabel setText:[@"发动机号:" stringByAppendingString:model[@"CI_ENGINE_NUM"]]];
  57. [lblCtype setText:[@"培训车型:" stringByAppendingString:model[@"CI_PERMIT_DRIVE_CAR_TYPE"]]];
  58. [lblSname setText:[@"所属驾校:" stringByAppendingString:model[@"CI_SCHOOL_NAME"]]];
  59. // [lblCtype setText:model[@""]];
  60. }
  61. -(void)layoutSubviews
  62. {
  63. [super layoutSubviews];
  64. CGFloat x,y,w,h;
  65. x = 20;
  66. w = self.width - x*2;
  67. h = 30;
  68. y = 0;
  69. [self.textLabel setFrame:CGRectMake(x, y, w, h)];
  70. y += h;
  71. [self.detailTextLabel setFrame:CGRectMake(x, y, w, h)];
  72. y += h;
  73. [lblSname setFrame:CGRectMake(x, y, w, h)];
  74. y += h;
  75. [lblCtype setFrame:CGRectMake(x, y, w, h)];
  76. }
  77. @end
  78. CGFloat CarCellHeight()
  79. {
  80. return 4 * 30;
  81. }