BDFaceLogoView+RQExtension.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // BDFaceLogoView+RQExtension.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2021/9/30.
  6. // Copyright © 2021 JCZ. All rights reserved.
  7. //
  8. #import "BDFaceLogoView+RQExtension.h"
  9. @implementation BDFaceLogoView (RQExtension)
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. UILabel *logoLabel = [[UILabel alloc] init];
  14. logoLabel.textAlignment = NSTextAlignmentLeft;
  15. logoLabel.textColor = UIColor.blackColor;
  16. logoLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:17];
  17. logoLabel.numberOfLines = 0;
  18. NSMutableAttributedString *attributedStr = [NSMutableAttributedString setupAttributeString:@" 1.请使头像正面位于画面框中;\n 2.请使头像尽量清晰;\n 3.请保证眼镜不反光,双眼可见;\n 4.请保证无墨镜,口罩等遮掩物;\n 5.照片存档,请注意个人仪态及所处环境;\n" rangeText:@"5.照片存档,请注意个人仪态及所处环境;" textColor:UIColor.redColor textFont:[UIFont rq_fontForPingFangSC_SemiboldFontOfSize:17]];
  19. logoLabel.attributedText = attributedStr.copy;
  20. [self addSubview:logoLabel];
  21. self.width = self.width - 16;
  22. self.height = [logoLabel.text heightForWid:self.width - 32 Font:17] + 20;
  23. self.x = 8;
  24. self.y = self.y - self.height;
  25. self.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.2];
  26. self.layer.cornerRadius = 10;
  27. self.layer.masksToBounds = YES;
  28. [logoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.top.mas_offset(8);
  30. make.bottom.right.mas_offset(-8);
  31. }];
  32. }
  33. return self;
  34. }
  35. @end