BuyVipTopView.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // BuyVipTopView.m
  3. // 隐私保护
  4. //
  5. // Created by APPLE on 2023/8/25.
  6. //
  7. #import "BuyVipTopView.h"
  8. #import <Masonry.h>
  9. @implementation BuyVipTopView
  10. @synthesize titleLabel;
  11. @synthesize vaildTimeLabel;
  12. /*
  13. // Only override drawRect: if you perform custom drawing.
  14. // An empty implementation adversely affects performance during animation.
  15. - (void)drawRect:(CGRect)rect {
  16. // Drawing code
  17. }
  18. */
  19. - (id)initWithFrame:(CGRect)frame{
  20. self = [super initWithFrame:frame];
  21. [self drawAnyView];
  22. return self;
  23. }
  24. - (void)drawAnyView{
  25. titleLabel = [[UILabel alloc] init];
  26. [self addSubview:titleLabel];
  27. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.top.mas_equalTo(30.f);
  29. make.left.mas_equalTo(20.f);
  30. make.height.mas_equalTo(33.f);
  31. }];
  32. [titleLabel setTextColor:HWFFFFFFColor];
  33. NSString *leftStr0 = NSLocalizedString(@"buy_vip_top_title",nil);
  34. NSString *rightStr0 = @"VIP";
  35. NSString *showStr = [leftStr0 stringByAppendingString:rightStr0];
  36. NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:showStr attributes: @{NSFontAttributeName: [UIFont systemFontOfSize:16.f]}];
  37. [string addAttributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:24.f]} range:NSMakeRange(leftStr0.length, rightStr0.length)];
  38. [titleLabel setAttributedText:string];
  39. vaildTimeLabel = [[UILabel alloc] init];
  40. [self addSubview:vaildTimeLabel];
  41. [vaildTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.bottom.mas_equalTo(-28.f);
  43. make.right.mas_equalTo(-20.f);
  44. make.left.mas_equalTo(33.f);
  45. }];
  46. [vaildTimeLabel setTextAlignment:(NSTextAlignmentRight)];
  47. [vaildTimeLabel setTextColor:HWFFFFFFColor];
  48. [vaildTimeLabel setFont:[UIFont systemFontOfSize:12]];
  49. NSString *leftStr = NSLocalizedString(@"buy_vip_top_vaildtime",nil);
  50. NSString *timeStr = @"2023-04-22";
  51. [vaildTimeLabel setText:[leftStr stringByAppendingString:timeStr]];
  52. }
  53. @end