TextCell.m 1007 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // TextCell.m
  3. // BeautyDemo
  4. //
  5. // Created by kennethmiao on 17/5/9.
  6. // Copyright © 2017年 kennethmiao. All rights reserved.
  7. //
  8. #import "TextCell.h"
  9. #import "ColorMacro.h"
  10. @implementation TextCell
  11. - (id)initWithFrame:(CGRect)frame
  12. {
  13. self = [super initWithFrame:frame];
  14. if(self){
  15. [self setupView];
  16. }
  17. return self;
  18. }
  19. + (NSString *)reuseIdentifier
  20. {
  21. return NSStringFromClass([self class]);
  22. }
  23. - (void)setSelected:(BOOL)selected
  24. {
  25. if(selected){
  26. self.label.textColor = UIColorFromRGB(0xFF584C);
  27. }
  28. else{
  29. self.label.textColor = [UIColor whiteColor];
  30. }
  31. }
  32. - (void)setupView
  33. {
  34. self.layer.borderColor = [UIColor whiteColor].CGColor;
  35. self.label = [[UILabel alloc] initWithFrame:self.bounds];
  36. self.label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  37. self.label.textColor = [UIColor whiteColor];
  38. self.label.textAlignment = NSTextAlignmentCenter;
  39. [self addSubview:self.label];
  40. }
  41. @end