《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRClassifyLeftTableViewCell.m 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // DRClassifyLeftTableViewCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/4/28.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRClassifyLeftTableViewCell.h"
  9. @implementation DRClassifyLeftTableViewCell
  10. {
  11. UILabel *_titleLabel;
  12. UILabel *_bottomLabel;
  13. }
  14. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  15. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  16. [self setupUI];
  17. }
  18. return self;
  19. }
  20. - (void)setupUI{
  21. self.backgroundColor = [UIColor yhGrayColor];
  22. _titleLabel = [[UILabel alloc]init];
  23. _titleLabel.textAlignment = NSTextAlignmentCenter;
  24. _titleLabel.textColor = [UIColor blueColor];
  25. _titleLabel.font = [UIFont systemFontOfSize:14];
  26. [self.contentView addSubview:_titleLabel];
  27. _bottomLabel = [[UILabel alloc]init];
  28. _bottomLabel.backgroundColor = [UIColor clearColor];
  29. [self.contentView addSubview:_bottomLabel];
  30. [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.right.top.equalTo(self.contentView);
  32. make.bottom.equalTo(self.contentView.mas_bottom).offset(-2);
  33. }];
  34. [_bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.bottom.equalTo(self.contentView.mas_bottom);
  36. make.size.mas_equalTo(CGSizeMake(40, 2));
  37. make.centerX.equalTo(self.contentView.mas_centerX);
  38. }];
  39. }
  40. - (void)setTitle:(NSString *)title{
  41. _title = title;
  42. _titleLabel.text = title;
  43. }
  44. - (void)setIsSelect:(BOOL)isSelect{
  45. _isSelect = isSelect;
  46. if (isSelect == YES) {
  47. _titleLabel.textColor = [UIColor baseColor];
  48. _bottomLabel.backgroundColor = [UIColor baseColor];
  49. self.backgroundColor = [UIColor whiteColor];
  50. }else{
  51. _titleLabel.textColor = [UIColor YHColorWithHex:0x666666];
  52. _bottomLabel.backgroundColor = [UIColor clearColor];
  53. self.backgroundColor = [UIColor yhGrayColor];
  54. }
  55. }
  56. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  57. [super setSelected:selected animated:animated];
  58. // Configure the view for the selected state
  59. }
  60. @end