84 lines
3.4 KiB
Objective-C
84 lines
3.4 KiB
Objective-C
//
|
|
// THBottleInfoBuyVipView.m
|
|
// TreeHole
|
|
//
|
|
// Created by iOS on 2023/2/9.
|
|
// Copyright © 2023 CYH. All rights reserved.
|
|
//
|
|
|
|
#import "THBottleInfoBuyVipView.h"
|
|
|
|
@interface THBottleInfoBuyVipView ()
|
|
@property(nonatomic, strong)UIImageView *bgImgView;
|
|
@property(nonatomic, strong)UILabel *buyVipLb;
|
|
@property(nonatomic, strong)QMUIButton *buyBtn;
|
|
@property(nonatomic, strong)QMUIButton *buyTipBtnView;
|
|
@property(nonatomic, strong)UIButton *disBtn;
|
|
|
|
@end
|
|
|
|
@implementation THBottleInfoBuyVipView
|
|
|
|
|
|
- (void)setVipDesc:(NSString *)vipDesc buyTip:(NSString *)buyTip {
|
|
self.buyVipLb.text = vipDesc;
|
|
[self.buyTipBtnView setTitle:buyTip forState:UIControlStateNormal];
|
|
[self setNeedsLayout];
|
|
}
|
|
|
|
|
|
- (void)setupSubViews {
|
|
_bgImgView = [UIImageView creatViewInSuperView:self];
|
|
_bgImgView.image = UIImageMake(@"pop_bottle_card");
|
|
_bgImgView.frame = self.bounds;
|
|
|
|
_buyVipLb = [UILabel creatLabelWithFont:UIFontMediumMake(15) textColor:UIColorMakeWithHex(@"#FFB902") inSuperView:self];
|
|
_buyVipLb.numberOfLines = 0;
|
|
_buyVipLb.textAlignment = NSTextAlignmentCenter;
|
|
_buyVipLb.qmui_lineHeight = [UIFontMediumMake(15) lineHeight] + 4;
|
|
// _buyVipLb.text = @"开通VIP";//动态文字
|
|
|
|
_buyBtn = [QMUIButton creatButtonWithFontSize:W_Scale(16) fontWeight:UIFontWeightMedium textColorHex:@"#000000" textState:UIControlStateNormal inSuperView:self];
|
|
_buyBtn.backgroundColor = COLOR_WITH_RGB(0xFFBE00);
|
|
[_buyBtn setTitle:@"开通VIP会员" forState:UIControlStateNormal];
|
|
_buyBtn.cornerRadius = QMUIButtonCornerRadiusAdjustsBounds;
|
|
|
|
_buyTipBtnView = [QMUIButton creatButtonWithFontSize:W_Scale(11) fontWeight:UIFontWeightMedium textColorHex:@"#FFFFFF" textState:UIControlStateNormal inSuperView:self];
|
|
|
|
[_buyTipBtnView setBackgroundImage:UIImageMake(@"TH_discount_tag_bg") forState:UIControlStateNormal];
|
|
_buyTipBtnView.contentEdgeInsets = UIEdgeInsetsMake(4, 5, 8, 5);
|
|
|
|
_disBtn = [UIButton creatButtonWithFont:UIFontMediumMake(W_Scale(13)) textColor:UIColorMakeWhiteAlpha(0.65) textState:UIControlStateNormal inSuperView:self];
|
|
[_disBtn setTitle:@"放弃此瓶" forState:UIControlStateNormal];
|
|
}
|
|
|
|
- (void)layoutSubviews {
|
|
[super layoutSubviews];
|
|
|
|
[self.disBtn sizeToFit];
|
|
self.disBtn.qmui_bottom = self.qmui_height - 15;
|
|
self.disBtn.qmui_left = self.disBtn.qmui_leftWhenCenterInSuperview;
|
|
|
|
self.buyBtn.size = CGSizeMake(self.qmui_width, 45);
|
|
self.buyBtn.qmui_bottom = self.disBtn.qmui_top - 15;
|
|
|
|
[self.buyTipBtnView sizeToFit];
|
|
self.buyTipBtnView.qmui_bottom = self.buyBtn.qmui_top + self.buyBtn.qmui_height * 0.2;
|
|
self.buyTipBtnView.qmui_left = self.buyBtn.centerX;
|
|
|
|
// self.buyVipLb.frame = CGRectMake(0, 0, self.qmui_width, self.buyBtn.qmui_top - 10);
|
|
CGSize buyVipLbSize = [self.buyVipLb sizeThatFits:CGSizeMake(self.qmui_width, CGFLOAT_MAX)];
|
|
self.buyVipLb.size = CGSizeMake(self.qmui_width, buyVipLbSize.height);
|
|
self.buyVipLb.qmui_bottom = self.buyTipBtnView.qmui_top - 20;
|
|
|
|
self.bgImgView.frame = CGRectMake(0, 0, self.qmui_width, self.buyBtn.centerY);
|
|
}
|
|
|
|
- (CGSize)sizeThatFits:(CGSize)size {
|
|
CGSize buyVipLbSize = [self.buyVipLb sizeThatFits:CGSizeMake(self.qmui_width, CGFLOAT_MAX)];
|
|
CGFloat h = 15 + self.disBtn.qmui_height + 15 + self.buyBtn.qmui_height + self.buyTipBtnView.qmui_height + 20 + buyVipLbSize.height + 35;
|
|
return CGSizeMake(size.width, h);
|
|
}
|
|
|
|
@end
|