STVideoCateCell.m 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // STVideoCateCell.m
  3. // BuguLive
  4. //
  5. // Created by bugu on 2019/12/3.
  6. // Copyright © 2019 xfg. All rights reserved.
  7. //
  8. #import "STVideoCateCell.h"
  9. @implementation STVideoCateCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  15. [super setSelected:selected animated:animated];
  16. // Configure the view for the selected state
  17. }
  18. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  19. {
  20. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  21. if (self) {
  22. self.selectionStyle = UITableViewCellSelectionStyleNone;
  23. [self initViews];
  24. }
  25. return self;
  26. }
  27. - (void)initViews{
  28. QMUIButton *leftBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  29. leftBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  30. [leftBtn setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:UIControlStateNormal];
  31. leftBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  32. [leftBtn setTitle:ASLocalizedString(@"短视频分类")forState:UIControlStateNormal];
  33. leftBtn.imagePosition = QMUIButtonImagePositionLeft;
  34. [leftBtn setImage:[UIImage imageNamed:@"短视频分类"] forState:UIControlStateNormal];
  35. leftBtn.spacingBetweenImageAndTitle = 15;
  36. leftBtn.userInteractionEnabled = NO;
  37. self.leftBtn = leftBtn;
  38. //添加一个隐藏的 topicBtn
  39. QMUIButton *topicBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  40. topicBtn.titleLabel.font = [UIFont systemFontOfSize:14];
  41. topicBtn.userInteractionEnabled = NO;
  42. // topicBtn.imagePosition = QMUIButtonImagePositionRight;
  43. // topicBtn.spacingBetweenImageAndTitle = 15;
  44. topicBtn.frame = CGRectMake(kScreenW-90, 12, 60, 30);
  45. // topicBtn.layer.cornerRadius = 15;
  46. // topicBtn.clipsToBounds = YES;
  47. [topicBtn setTitle:@"选择分类" forState:UIControlStateNormal];
  48. // topicBtn.backgroundColor = [UIColor colorWithHexString:@"#FBF2FF"];
  49. [topicBtn setTitleColor:[UIColor colorWithHexString:@"#777777"] forState:UIControlStateNormal];
  50. // topicBtn.hidden = YES;
  51. // [topicBtn addTarget:self action:@selector(deleteTopicButtonClick) forControlEvents:UIControlEventTouchUpInside];
  52. [self addSubview:topicBtn];
  53. self.cateBtn = topicBtn;
  54. [self addSubview:self.leftBtn];
  55. [self.leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.left.equalTo(@10);
  57. make.centerY.equalTo(@0);
  58. make.width.equalTo(@110);
  59. }];
  60. UIImageView *rightImageView = [[UIImageView alloc]init];
  61. rightImageView.image = [UIImage imageNamed:@"进入"];
  62. [self addSubview:rightImageView];
  63. [rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.right.equalTo(self).offset(-10);
  65. make.centerY.equalTo(@0);
  66. make.size.mas_equalTo(CGSizeMake(7, 14));
  67. }];
  68. UIView *lineView = [[UIView alloc]init];
  69. lineView.backgroundColor = [UIColor colorWithHexString:@"#E6E6E6"];
  70. [self addSubview:lineView];
  71. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.left.right.bottom.equalTo(self);
  73. make.height.mas_equalTo(@1);
  74. }];
  75. }
  76. @end