TiUISubMenuOneViewCell.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // TiUISubMenuOneViewCell.m
  3. // TiSDKDemo
  4. //
  5. // Created by iMacA1002 on 2019/12/4.
  6. // Copyright © 2020 Tillusory Tech. All rights reserved.
  7. //
  8. #import "TiUISubMenuOneViewCell.h"
  9. #import "TIButton.h"
  10. @interface TiUISubMenuOneViewCell ()
  11. @property(nonatomic ,strong)TIButton *cellButton;
  12. @end
  13. @implementation TiUISubMenuOneViewCell
  14. -(TIButton *)cellButton{
  15. if (_cellButton==nil) {
  16. _cellButton = [[TIButton alloc]initWithScaling:0.9];
  17. _cellButton.userInteractionEnabled = NO;
  18. }
  19. return _cellButton;
  20. }
  21. - (instancetype)initWithFrame:(CGRect)frame
  22. {
  23. self = [super initWithFrame:frame];
  24. if (self) {
  25. [self addSubview:self.cellButton];
  26. [self.cellButton mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.top.bottom.equalTo(self);
  28. make.left.equalTo(self.mas_left).offset(6);
  29. make.right.equalTo(self.mas_right).offset(-6);
  30. }];
  31. }
  32. return self;
  33. }
  34. - (void)setSubMod:(TIMenuMode *)subMod{
  35. if (subMod) {
  36. _subMod = subMod;
  37. [self.cellButton setTitle:[NSString stringWithFormat:@"%@",subMod.name]
  38. withImage:[UIImage imageNamed:subMod.normalThumb]
  39. withTextColor:TI_Color_Default_Text_Black
  40. forState:UIControlStateNormal];
  41. [self.cellButton setTitle:[NSString stringWithFormat:@"%@",subMod.name]
  42. withImage:[UIImage imageNamed:subMod.selectedThumb]
  43. withTextColor:TI_Color_Default_Background_Pink
  44. forState:UIControlStateSelected];
  45. [self.cellButton setSelected:subMod.selected];
  46. }
  47. }
  48. @end