TCTextCollectionCell.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // TCTextCollectionCell.m
  3. // DeviceManageIOSApp
  4. //
  5. // Created by rushanting on 2017/5/22.
  6. // Copyright © 2017年 tencent. All rights reserved.
  7. //
  8. #import "TCTextCollectionCell.h"
  9. #import "ColorMacro.h"
  10. //#import "UIView+AdditionsX12.h"
  11. @implementation TCTextCollectionCell
  12. - (id)initWithFrame:(CGRect)frame
  13. {
  14. if (self = [super initWithFrame:frame]) {
  15. self.layer.borderWidth = 1;
  16. self.layer.borderColor = UIColorFromRGB(0x777777).CGColor;
  17. self.backgroundColor = UIColor.clearColor;
  18. _textLabel = [UILabel new];
  19. _textLabel.text = YZMsg(@"点击添加文字");
  20. _textLabel.font = [UIFont systemFontOfSize:9];
  21. _textLabel.textAlignment = NSTextAlignmentCenter;
  22. _textLabel.textColor = UIColorFromRGB(0xFFFFFF);
  23. _textLabel.numberOfLines = 2;
  24. [self.contentView addSubview:_textLabel];
  25. }
  26. return self;
  27. }
  28. - (void)layoutSubviews
  29. {
  30. [super layoutSubviews];
  31. _textLabel.frame = CGRectMake(5, 6, self.contentView.width - 10, self.contentView.height - 14);
  32. }
  33. - (void)setSelected:(BOOL)selected
  34. {
  35. if (!selected) {
  36. _textLabel.textColor = UIColorFromRGB(0xFFFFFF);
  37. self.layer.borderColor = UIColorFromRGB(0x777777).CGColor;
  38. } else {
  39. _textLabel.textColor = Pink_Cor;//UIColorFromRGB(0x0accac);
  40. self.layer.borderWidth = 1;
  41. self.layer.borderColor = Pink_Cor.CGColor;//UIColorFromRGB(0x0accac).CGColor;
  42. }
  43. }
  44. @end