YOUPAIZYUserZiLiaoSHNoDataCell.m 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // YOUPAIZYUserZiLiaoSHNoDataCell.m
  3. // VQU
  4. //
  5. // Created by 肖浩然的mac on 2021/7/16.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAIZYUserZiLiaoSHNoDataCell.h"
  9. @implementation YOUPAIZYUserZiLiaoSHNoDataCell
  10. -(instancetype)initWithFrame:(CGRect)frame{
  11. if (self = [super initWithFrame:frame]) {
  12. [self youpaifsetSubView];
  13. }
  14. return self;
  15. }
  16. -(void)youpaifsetSubView{
  17. UIView *titleView = [UIView new];
  18. [self.contentView addSubview:titleView];
  19. [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
  20. make.left.mas_equalTo(0);
  21. make.right.mas_equalTo(0);
  22. make.top.mas_equalTo(0);
  23. make.height.mas_equalTo(43);
  24. }];
  25. titleView.backgroundColor = LCBkgColor;
  26. self.youpaiptitleLabel = [[UILabel alloc] init];
  27. self.youpaiptitleLabel.font = LCBoldFont(14);
  28. [titleView addSubview:self.youpaiptitleLabel];
  29. [self.youpaiptitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.centerY.mas_equalTo(0);
  31. make.left.mas_equalTo(14);
  32. }];
  33. UIView *contentView = [UIView new];
  34. [self.contentView addSubview:contentView];
  35. [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.top.mas_equalTo(titleView.mas_bottom);
  37. make.left.mas_offset(0);
  38. make.right.mas_offset(0);
  39. make.bottom.mas_offset(0.f);
  40. }];
  41. contentView.backgroundColor = LCBkgColor;
  42. //分割线
  43. UIView *viewLine =[UIView new];
  44. [self addSubview:viewLine];
  45. [viewLine mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.mas_equalTo(14);
  47. make.right.mas_equalTo(-14);
  48. make.bottom.mas_equalTo(0);
  49. make.height.mas_equalTo(0.5f);
  50. }];
  51. viewLine.backgroundColor =HexColorFromRGB(0x28262D);
  52. UILabel *hintLabel = [UILabel new];
  53. [contentView addSubview:hintLabel];
  54. [hintLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.centerX.mas_equalTo(0);
  56. make.top.mas_equalTo(0);
  57. }];
  58. hintLabel.text = @"还没有人守护Ta";
  59. hintLabel.font = [UIFont systemFontOfSize:14];
  60. hintLabel.textColor = HexColorFromRGB(0x6C6B70);
  61. //庇护按钮
  62. _youpaipshouhuBtn = [UIButton new];
  63. [contentView addSubview:_youpaipshouhuBtn];
  64. [_youpaipshouhuBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.top.mas_equalTo(hintLabel.mas_bottom).offset(8);
  66. make.centerX.mas_equalTo(0);
  67. make.size.mas_equalTo(CGSizeMake(ScaleSize(77), 22));
  68. }];
  69. [_youpaipshouhuBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(ScaleSize(77), 22) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1] forState:UIControlStateNormal];
  70. [_youpaipshouhuBtn setTitle:@"我要守护" forState:UIControlStateNormal];
  71. _youpaipshouhuBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  72. [_youpaipshouhuBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  73. _youpaipshouhuBtn.layer.cornerRadius = 11;
  74. _youpaipshouhuBtn.layer.masksToBounds = YES;
  75. [_youpaipshouhuBtn addTarget:self action:@selector(youpaifshouhuBtnClick) forControlEvents:UIControlEventTouchUpInside];
  76. }
  77. -(void)youpaifshouhuBtnClick{
  78. if (self.youpaipdidClickSh) {
  79. self.youpaipdidClickSh();
  80. }
  81. }
  82. -(void)setYoupaipdataArr:(NSArray *)dataArr{
  83. _youpaipdataArr = dataArr;
  84. self.youpaiptitleLabel.attributedText = [LCTools setRichTextWithTitle:@"守护" subTitle:[NSString stringWithFormat:@"(%lu人)",(unsigned long)self.youpaipdataArr.count] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0x9F9DA5) titleFontSize:14 subTitleFontSize:12];
  85. }
  86. @end