YOUPAISYBaseTableCell.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // YOUPAISYBaseTableCell.m
  3. // VQU
  4. //
  5. // Created by leo on 2020/4/21.
  6. // Copyright © 2020 leo. All rights reserved.
  7. //
  8. #import "YOUPAISYBaseTableCell.h"
  9. @implementation YOUPAISYBaseTableCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. + (instancetype)cellWithTableView:(UITableView *)tableView {
  14. NSString *className = NSStringFromClass([self class]);
  15. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:className];
  16. if(!cell) {
  17. cell = [[[super class] alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:className];
  18. }
  19. return (YOUPAISYBaseTableCell *)cell;
  20. }
  21. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  22. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  23. [self youpaifsetupUI];
  24. }
  25. return self;
  26. }
  27. - (void)youpaifsetupUI {
  28. self.backgroundColor = UIColor.whiteColor;
  29. self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds] ;
  30. self.selectedBackgroundView.backgroundColor = [UIColor whiteColor];
  31. [self setNeedsUpdateConstraints];
  32. }
  33. - (void)dealloc {
  34. NSLog(@"%@ 释放了...", NSStringFromClass([self class]));
  35. }
  36. @end