| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //
- // VIPFunctView.m
- // 隐私保护
- //
- // Created by APPLE on 2023/8/24.
- //
- #import "VIPFunctForBuyView.h"
- #import <Masonry.h>
- @interface VIPFunctForBuyView(){
- }
- @end
- @implementation VIPFunctForBuyView
- - (id)initWithFunAry:(NSArray *)titleAry{
- self = [super init];
-
- [self drawAnyViewWithAry:titleAry];
-
- return self;
- }
- - (void)drawAnyViewWithAry:(NSArray *)titleAry{
- /*上方文字*/
- UILabel *topLabel = [[UILabel alloc] init];
- [topLabel setFont:[UIFont boldSystemFontOfSize:16.f]];
- [topLabel setTextColor:HW0A132BColor];
- [topLabel setText:NSLocalizedString(@"buy_home_fun_title",nil)];
- [topLabel setTextAlignment:(NSTextAlignmentCenter)];
- [self addSubview:topLabel];
- [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(10);
- make.height.mas_equalTo(22);
- }];
-
- CGFloat w_Line = 56.f*AUTOSCALE;
- CGFloat h_line = 2.f;
- UIView *lineLeft = [[UIButton alloc] init];
- lineLeft.frame = CGRectMake(0, 0, w_Line, 2.f);
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,w_Line,h_line);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0A132BColor00.CGColor, (__bridge id)HW182B56Color.CGColor];
- gl.locations = @[@(0), @(1.0f)];
- [lineLeft.layer addSublayer:gl];
- [self addSubview:lineLeft];
- [lineLeft mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(topLabel.mas_centerY);
- make.right.equalTo(self.mas_centerX).offset(-82);
- make.width.mas_equalTo(w_Line);
- make.height.mas_equalTo(h_line);
- }];
-
- UIView *lineRight = [[UIButton alloc] init];
- lineRight.frame = CGRectMake(0, 0, w_Line, 2.f);
- // gradient
- CAGradientLayer *gl1 = [CAGradientLayer layer];
- gl1.frame = CGRectMake(0,0,w_Line,h_line);
- gl1.startPoint = CGPointMake(0, 0.5);
- gl1.endPoint = CGPointMake(1, 0.5);
- gl1.colors = @[(__bridge id)HW182B56Color.CGColor, (__bridge id)HW0A132BColor00.CGColor];
- gl1.locations = @[@(0), @(1.0f)];
- [lineRight.layer addSublayer:gl1];
- [self addSubview:lineRight];
- [lineRight mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(topLabel.mas_centerY);
- make.left.equalTo(self.mas_centerX).offset(82);
- make.width.mas_equalTo(w_Line);
- make.height.mas_equalTo(h_line);
- }];
- /*绘制标签*/
- for (NSInteger nFori = 0; nFori < titleAry.count; nFori++) {
- UIButton *flagBtn = [[UIButton alloc] init];
- [flagBtn setImage:[UIImage imageNamed:@"buy_home_flag_fun"] forState:(UIControlStateNormal)];
- [flagBtn setTitleColor:HW666666Color forState:(UIControlStateNormal)];
- [flagBtn.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
- [flagBtn setTitle:[titleAry objectAtIndex:nFori] forState:(UIControlStateNormal)];
- [flagBtn setContentHorizontalAlignment:(UIControlContentHorizontalAlignmentLeft)];
- [self addSubview:flagBtn];
-
- /*计算位置*/
- NSInteger x_place = nFori%2;
- NSInteger y_palce = nFori/2;
- [flagBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- if (x_place == 0){
- make.left.mas_equalTo(28);
- }else{
- make.left.equalTo(self.mas_centerX).offset(28);
- }
- make.width.mas_equalTo(140);
- make.top.mas_equalTo(42 + y_palce*(18.f+8.f));
- make.height.mas_equalTo(18);
- }];
- }
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- @end
|