TiUIMenuViewCell.m 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // TiUIMenuViewCell.m
  3. // TiSDKDemo
  4. //
  5. // Created by iMacA1002 on 2019/12/2.
  6. // Copyright © 2020 Tillusory Tech. All rights reserved.
  7. //
  8. #import "TiUIMenuViewCell.h"
  9. @interface TiUIMenuViewCell ()
  10. @property(nonatomic,strong)UILabel *textLabel;
  11. @end
  12. @implementation TiUIMenuViewCell
  13. -(UILabel *)textLabel{
  14. if (_textLabel == nil) {
  15. _textLabel = [[UILabel alloc]init];
  16. _textLabel.textAlignment = NSTextAlignmentCenter;
  17. _textLabel.userInteractionEnabled = YES;
  18. _textLabel.font = TI_Font_Default_Size_Medium;
  19. _textLabel.textColor = TI_Color_Default_Text_Black;
  20. }
  21. return _textLabel;
  22. }
  23. - (instancetype)initWithFrame:(CGRect)frame
  24. {
  25. self = [super initWithFrame:frame];
  26. if (self) {
  27. [self addSubview:self.textLabel];
  28. [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.top.bottom.left.right.equalTo(self);
  30. }];
  31. }
  32. return self;
  33. }
  34. -(void)setMenuMode:(TIMenuMode *)menuMode{
  35. if (menuMode) {
  36. _menuMode = menuMode;
  37. self.textLabel.text = menuMode.name;
  38. BOOL highlighted = menuMode.selected;
  39. if (highlighted)
  40. {
  41. self.textLabel.textColor = TI_Color_Default_Background_Pink;
  42. }
  43. else
  44. {
  45. self.textLabel.textColor = TI_Color_Default_Text_Black;
  46. }
  47. }
  48. }
  49. @end