| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //
- // GuiZuBottomView.m
- // BuguLive
- //
- // Created by bugu on 2019/12/2.
- // Copyright © 2019 xfg. All rights reserved.
- //
- #import "GuiZuBottomView.h"
- @interface GuiZuBottomView ()
- @property(nonatomic, strong) UILabel *giftLabel;
- @property(nonatomic, strong) UILabel *moneyLabel;
- @property(nonatomic, strong) UIButton *sureBtn;
- @end
- @implementation GuiZuBottomView
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- [self initUI];
- }
- return self;
- }
- - (void)initUI{
- self.backgroundColor = kWhiteColor;
- self.layer.shadowColor = [UIColor colorWithRed:211/255.0 green:211/255.0 blue:211/255.0 alpha:0.5].CGColor;
- self.layer.shadowOffset = CGSizeMake(0,-1);
- self.layer.shadowOpacity = 1;
- self.layer.shadowRadius = 2;
-
- _giftLabel = ({
- UILabel * label = [[UILabel alloc]init];
- label.textColor = [UIColor colorWithHexString:@"#333333"];
- label.font = [UIFont systemFontOfSize:14];
- label.text = @"";
- label;
- });
- _moneyLabel = ({
- UILabel * label = [[UILabel alloc]init];
- label.textColor = [UIColor colorWithHexString:@"#666666"];
- label.font = [UIFont systemFontOfSize:14];
- label.text = @"";
- label;
- });
-
- _sureBtn = ({
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- [btn setBackgroundImage:[UIImage imageNamed:@"贵族立即开通按钮"] forState:UIControlStateNormal];
- // [btn setTitle:ASLocalizedString(@"知道啦")forState:UIControlStateNormal];
- // [btn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- // btn.titleLabel.font = [UIFont systemFontOfSize:14];
- [btn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside];
- btn;
- });
- [self addSubview:_giftLabel];
- [self addSubview:_moneyLabel];
- [self addSubview:_sureBtn];
-
- }
- - (void)sureAction{
-
- !self.buyBlock ? : self.buyBlock();
-
-
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
-
-
- [_giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.top.mas_equalTo(13);
- }];
- [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.bottom.mas_equalTo(-9);
- }];
- [_sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-10);
- make.centerY.mas_equalTo(0);
- }];
-
- }
- - (void)setDataWithGift:(NSString *)gift money:(NSString *)money day:(NSString *)day{
-
- NSString * str = [NSString stringWithFormat:ASLocalizedString(@"立即获得%@钻石"),gift];
-
- NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc]initWithString:str];
-
-
- [attribute setAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#BC8D50"]} range:NSMakeRange(ASLocalizedString(@"立即获得").length, gift.length)];
- [_giftLabel setAttributedText:attribute];
- _moneyLabel.text = [NSString stringWithFormat:ASLocalizedString(@"%@元/%@天"),money,day];
- }
- @end
|