BGRoomSetChannelCollectCell.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // BGRoomSetChannelCollectCell.m
  3. // UniversalApp
  4. //
  5. // Created by bugu on 2020/3/23.
  6. // Copyright © 2020 voidcat. All rights reserved.
  7. //
  8. #import "BGRoomSetChannelCollectCell.h"
  9. #import "HallTypeModel.h"
  10. #import "RoomModel.h"
  11. @implementation BGRoomSetChannelCollectCell
  12. - (instancetype)initWithFrame:(CGRect)frame
  13. {
  14. self = [super initWithFrame:frame];
  15. if (self) {
  16. [self initUI];
  17. }
  18. return self;
  19. }
  20. - (void)initUI {
  21. self.backgroundColor = [UIColor clearColor];
  22. self.contentView.backgroundColor = [UIColor clearColor];
  23. _titleLabel= ({
  24. UILabel * label = [[UILabel alloc]init];
  25. label.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
  26. label.font = [UIFont systemFontOfSize:16];
  27. label.text = @"闲聊";
  28. label.textAlignment = NSTextAlignmentCenter;
  29. label.layer.cornerRadius = 4;
  30. label.clipsToBounds = YES;
  31. label;
  32. });
  33. [self addSubview:_titleLabel];
  34. _titleLabel.frame = self.bounds;
  35. }
  36. -(void)setModel:(VideoClassifiedModel *)model{
  37. _model = model;
  38. [self setSelected:model.isSelected];
  39. [self.titleLabel setText:model.title];
  40. }
  41. - (void)setSelected:(BOOL)selected{
  42. if (selected) {
  43. self.titleLabel.backgroundColor = [UIColor qmui_colorWithHexString:@"#AE2CF1"];
  44. self.titleLabel.textColor = kWhiteColor;
  45. }
  46. else{
  47. self.titleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
  48. self.titleLabel.textColor = [UIColor whiteColor];
  49. }
  50. }
  51. @end