KSchoolCell.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // KSchoolCell.m
  3. // jiaPei
  4. //
  5. // Created by apple on 16/4/28.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "KSchoolCell.h"
  9. @implementation KSchoolCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  15. {
  16. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  17. if (self) {
  18. CGFloat width = (kSize.width - 16)/7.0;
  19. CGFloat x,y,w,h,bd;
  20. x = bd = 8;
  21. y = 0;
  22. w = 2*width;
  23. h = 43.5;
  24. UILabel *label = [[UILabel alloc] setxywh];
  25. label.textAlignment = NSTextAlignmentCenter;
  26. label.textColor = kTitleColor;
  27. [label setFont:[UIFont scaleSize:NormalFont]];
  28. [self.contentView addSubview:label];
  29. _nameLabel = label;
  30. x += 2.5*width;
  31. w = width;
  32. label = [[UILabel alloc] setxywh];
  33. label.textAlignment = NSTextAlignmentCenter;
  34. label.textColor = kTitleColor;
  35. [label setFont:[UIFont scaleSize:NormalFont]];
  36. [self.contentView addSubview:label];
  37. _carTypeLabel = label;
  38. x += 2*width;
  39. label = [[UILabel alloc] setxywh];
  40. label.textAlignment = NSTextAlignmentRight;
  41. label.textColor = [UIColor redColor];
  42. [label setFont:[UIFont scaleSize:NormalFont]];
  43. [self.contentView addSubview:label];
  44. _priceLabel = label;
  45. w += 10;
  46. x += width;
  47. label = [[UILabel alloc] setxywh];
  48. label.textAlignment = NSTextAlignmentLeft;
  49. label.textColor = kTitleColor;
  50. [label setFont:[UIFont scaleSize:NormalFont]];
  51. [self.contentView addSubview:label];
  52. _unitLabel = label;
  53. }
  54. return self;
  55. }
  56. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  57. [super setSelected:selected animated:animated];
  58. // Configure the view for the selected state
  59. }
  60. @end