// // YOUPAIZYNobleSaleWindow.m // VQU // // Created by Elaine on 2021/8/23. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIZYNobleSaleWindow.h" #import "UIViewController+TFPresent.h" #import "YOUPAIZYNobleDetailModel.h" @interface YOUPAIZYNobleSaleWindow () @property(nonatomic,strong)UIView* youpaipbaseV; @property(nonatomic,strong)UIButton* youpaipokBtn; @end @implementation YOUPAIZYNobleSaleWindow - (void)viewDidLoad { [super viewDidLoad]; self.baseView.backgroundColor = HexColorFromRGB(0x2A2935); UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15,20,self.vWidth-30,22)]; label.text = @"贵族享受优惠"; label.textAlignment = NSTextAlignmentCenter; label.textColor = HexColorFromRGB(0xF9F9FF); label.font = LCBoldFont(19); [self.baseView addSubview:label]; UIView *baseV = [[UIView alloc] initWithFrame:CGRectMake(14,62, self.vWidth-28,self.youpaipdataArray.count * 35+33)]; baseV.backgroundColor = [UIColor clearColor]; baseV.layer.borderWidth = 0.5; baseV.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor; baseV.layer.masksToBounds = YES; baseV.layer.cornerRadius = 8.0; self.youpaipbaseV = baseV; [self.baseView addSubview:baseV]; UIView *itemV = [[UIView alloc] initWithFrame:CGRectMake(0,0, self.vWidth-28,33)]; itemV.backgroundColor = HexColorFromRGB(0xDBA84A); [baseV addSubview:itemV]; [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:itemV size:CGSizeMake(8.0f, 8.0f)]; NSArray *itemArr = @[@"等级",LCStr(word0),LCStr(word1)]; for (int i = 0; i<3; i++) { UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0*i,0,(self.vWidth-28)/3.0,33)]; lab.text =itemArr[i]; lab.textAlignment = NSTextAlignmentCenter; lab.textColor = HexColorFromRGB(0xFFFFFF); lab.font = LCBoldFont(14); [itemV addSubview:lab]; if (i>0) { UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0*i,0,0.5,baseV.frame.size.height)]; line.backgroundColor = HexColorFromRGB(0x4F4B5B); [self.youpaipbaseV addSubview:line]; } } [self youpaifinitUI]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(29, self.vHeight - 48 - 31,self.vWidth - 29*2, 48); btn.layer.masksToBounds = YES; btn.layer.cornerRadius = 24; btn.titleLabel.font = LCFont(17); [btn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:UIControlStateNormal]; [btn setBackgroundImage:[LCTools ColorImage:CGSizeMake(self.vWidth - 29*2, 48) FromColors:@[HexColorFromRGB(0xEFD381),HexColorFromRGB(0xDBA84A)] ByGradientType:1] forState:UIControlStateNormal]; [btn setTitle:@"好的" forState:UIControlStateNormal]; self.youpaipokBtn = btn; [btn addTarget:self action:@selector(youpaifokBtnAction) forControlEvents:UIControlEventTouchUpInside]; [self.baseView addSubview:btn]; } -(void)youpaifokBtnAction { [self dismissViewControllerAnimated:YES completion:nil]; } -(void)youpaifinitUI { for (int i = 0; i< self.youpaipdataArray.count; i++) { YOUPAIZYNobleDetailModel *model = self.youpaipdataArray[i]; UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,33+35*i,self.youpaipbaseV.frame.size.width,35)]; [self.youpaipbaseV addSubview:view]; if (i != self.youpaipdataArray.count - 1) { UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0,34.5,self.youpaipbaseV.frame.size.width,0.5)]; line.backgroundColor = HexColorFromRGB(0x4F4B5B); [view addSubview:line]; } UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(6.5, 8, 30, 19)]; // imageV.backgroundColor = [UIColor grayColor]; imageV.contentMode = UIViewContentModeScaleAspectFit; [imageV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipimg]]; [view addSubview:imageV]; UILabel *lab1 = [[UILabel alloc] initWithFrame:CGRectMake(40.5,0,(self.vWidth-28)/3.0-44.5,35)]; lab1.text = model.youpaipname; lab1.textColor = HexColorFromRGB(0xFFFFFF); lab1.font = LCBoldFont(12); [view addSubview:lab1]; UILabel *lab2 = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0,0,(self.vWidth-28)/3.0,35)]; lab2.text = model.youpaipdis; lab2.textAlignment = NSTextAlignmentCenter; lab2.textColor = HexColorFromRGB(0xFFFFFF); lab2.font = LCBoldFont(12); [view addSubview:lab2]; UILabel *lab3 = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0*2,0,(self.vWidth-28)/3.0,35)]; lab3.text = [NSString stringWithFormat:@"%@钻石",model.youpaipprice]; lab3.textAlignment = NSTextAlignmentCenter; lab3.textColor = HexColorFromRGB(0xFFFFFF); lab3.font = LCBoldFont(12); [view addSubview:lab3]; } } @end