HomeSchoolCell.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // HomeSchoolCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/5/16.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "HomeSchoolCell.h"
  9. @implementation HomeSchoolCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. self.addressL.layer.cornerRadius = 2.f;
  13. self.addressL.layer.masksToBounds = YES;
  14. self.addressL.backgroundColor = UIColorHex(0xF4F4F4);
  15. self.numL.layer.cornerRadius = 2.f;
  16. self.numL.layer.masksToBounds = YES;
  17. self.numL.backgroundColor = UIColorHex(0xF4F4F4);
  18. self.levelL.layer.cornerRadius = 2.f;
  19. self.levelL.layer.masksToBounds = YES;
  20. self.levelL.backgroundColor = UIColorHex(0xF4F4F4);
  21. }
  22. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  23. [super setSelected:selected animated:animated];
  24. // Configure the view for the selected state
  25. }
  26. + (HomeSchoolCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  27. static NSString *cellIdentifer = @"HomeSchoolCell";
  28. HomeSchoolCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  29. if (cell == nil) {
  30. cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeSchoolCell" owner:nil options:nil] objectAtIndex:0];
  31. }
  32. return cell;
  33. }
  34. - (void)setData
  35. {
  36. self.addressL.text = @"北京";
  37. self.numL.text = @"特级教师36人";
  38. self.levelL.text = @"小学、初中";
  39. self.addW.constant = [self addPlaceLabel:self.addressL];
  40. self.numW.constant = [self addPlaceLabel:self.numL];
  41. self.levelW.constant = [self addPlaceLabel:self.levelL];
  42. }
  43. - (CGFloat)addPlaceLabel:(UILabel *)label
  44. {
  45. CGFloat W = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 18)].width + 16;
  46. return W;
  47. }
  48. @end