YOUPAITFBaseCell.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // TFCommonCell.m
  3. // trueface
  4. //
  5. // Created by Apple on 2019/10/9.
  6. // Copyright © 2019 jie. All rights reserved.
  7. //
  8. #import "YOUPAITFBaseCell.h"
  9. @implementation YOUPAITFBaseCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. +(instancetype)youpaifcellWithTableViewCell:(UITableView *)tableView
  15. {
  16. NSString *className = NSStringFromClass([self class]);
  17. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:className];
  18. if(cell == nil)
  19. {
  20. cell = [[[super class] alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:className];
  21. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  22. //v.1.5.6适配暗黑模式 动态
  23. [cell.contentView setBackgroundColor:[UIColor whiteColor]];
  24. }
  25. return (YOUPAITFBaseCell *)cell;
  26. }
  27. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  28. {
  29. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  30. [self youpaifsetupUI];
  31. }
  32. return self;
  33. }
  34. -(void)youpaifsetupUI
  35. {
  36. [self.contentView setBackgroundColor:[UIColor whiteColor]];
  37. [self setSelectionStyle:UITableViewCellSelectionStyleNone];
  38. }
  39. - (void)layoutSubviews
  40. {
  41. [super layoutSubviews];
  42. //
  43. // [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull subView, NSUInteger idx, BOOL * _Nonnull stop) {
  44. // if ([subView isKindOfClass:NSClassFromString(@"_UITableViewCellSeparatorView")]) {
  45. // subView.x = 0;
  46. // subView.width = KScreenW;
  47. // subView.height = 0.5;
  48. // [subView setBackgroundColor:[UIColor blackColor]];
  49. // }
  50. // }];
  51. }
  52. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  53. [super setSelected:selected animated:animated];
  54. // Configure the view for the selected state
  55. }
  56. @end