| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // CellWithBtnView.m
- // 隐私保护
- //
- // Created by APPLE on 2023/8/24.
- //
- #import "CellWithBtnView.h"
- #import <Masonry.h>
- @implementation CellWithBtnView
- @synthesize topLabel;
- @synthesize downLabel;
- @synthesize rightBtn;
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
-
- [self drawAnyView];
-
- return self;
- }
- - (void)drawAnyView{
- topLabel = [[UILabel alloc] init];
- [topLabel setTextColor:HW0A132BColor];
- [topLabel setFont:[UIFont boldSystemFontOfSize:16]];
- [topLabel setText:@"111111111"];
- [self addSubview:topLabel];
- [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(24.f);
- make.top.mas_equalTo(16.f);
- make.right.mas_equalTo(-124.f);
- make.height.mas_equalTo(20.f);
- }];
-
- downLabel = [[UILabel alloc] init];
- [downLabel setTextColor:HW666666Color];
- [downLabel setFont:[UIFont systemFontOfSize:10]];
- [downLabel setText:@"222222222"];
- [self addSubview:downLabel];
- [downLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(24.f);
- make.bottom.mas_equalTo(-17.f);
- make.right.mas_equalTo(-124.f);
- }];
-
- /*右侧按钮*/
- rightBtn = [[UIButton alloc] init];
- rightBtn.frame = CGRectMake(0, 0, 84.f, 36.f);
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,84.f,36.f);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
- gl.locations = @[@(0), @(1.0f)];
-
- [rightBtn.layer addSublayer:gl];
- [rightBtn setTitle:@"3333333333" forState:(UIControlStateNormal)];
- [rightBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- [rightBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:12.f]];
- [rightBtn.layer setCornerRadius:18.f];
- rightBtn.clipsToBounds = YES;
- [self addSubview:rightBtn];
- [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.mas_centerY);
- make.width.mas_equalTo(84);
- make.right.mas_equalTo(-8.f);
- make.height.mas_equalTo(36);
- }];
- }
- @end
|