YOUPAISexView.m 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // YOUPAISexView.m
  3. // MSYOUPAI
  4. //
  5. // Created by CY on 2022/2/28.
  6. // Copyright © 2022 MS. All rights reserved.
  7. //
  8. #import "YOUPAISexView.h"
  9. @interface YOUPAISexView ()
  10. @property (nonatomic, weak) UIImageView *youpaipsexImgV;
  11. @property (nonatomic, weak) UILabel *youpaipageL;
  12. @end
  13. @implementation YOUPAISexView
  14. - (instancetype)init{
  15. if (self = [super init]) {
  16. [self youpaifinitUI];
  17. }
  18. return self;
  19. }
  20. - (void)youpaifinitUI{
  21. UIImageView *youpaipsexImgV = [[UIImageView alloc] init];
  22. [self addSubview:youpaipsexImgV];
  23. self.youpaipsexImgV = youpaipsexImgV;
  24. [youpaipsexImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.offset(4.0f);
  26. make.centerY.equalTo(self);
  27. make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
  28. }];
  29. UILabel *youpaipageL = [[UILabel alloc] init];
  30. youpaipageL.font = LCBoldFont(9.0f);
  31. [self addSubview:youpaipageL];
  32. self.youpaipageL = youpaipageL;
  33. [youpaipageL mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.left.equalTo(youpaipsexImgV.mas_right).offset(1.0f);
  35. make.centerY.equalTo(self);
  36. make.right.offset(0.0f);
  37. }];
  38. }
  39. - (void)youpaifreloadWithSex:(NSInteger)sex age:(NSInteger)age{
  40. self.mj_size = CGSizeMake(30.0f, 15.0f);
  41. self.layer.cornerRadius = 7.5f;
  42. self.clipsToBounds = YES;
  43. if (sex == 1) {//0未知 1女 2男
  44. self.backgroundColor = [LZFE66A4Color colorWithAlphaComponent:0.09f];
  45. self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_common_girl"];
  46. self.youpaipageL.textColor = LZFE66A4Color;
  47. }else{
  48. self.backgroundColor = [LZ1DBEF9Color colorWithAlphaComponent:0.09f];
  49. self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_common_boy"];
  50. self.youpaipageL.textColor = LZ1DBEF9Color;
  51. }
  52. self.youpaipageL.text = [NSString stringWithFormat:@"%@",@(age)];
  53. }
  54. @end