YOUPAIZYNobleSaleWindow.m 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // YOUPAIZYNobleSaleWindow.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/8/23.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIZYNobleSaleWindow.h"
  9. #import "UIViewController+TFPresent.h"
  10. #import "YOUPAIZYNobleDetailModel.h"
  11. @interface YOUPAIZYNobleSaleWindow ()
  12. @property(nonatomic,strong)UIView* youpaipbaseV;
  13. @property(nonatomic,strong)UIButton* youpaipokBtn;
  14. @end
  15. @implementation YOUPAIZYNobleSaleWindow
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. self.baseView.backgroundColor = HexColorFromRGB(0x2A2935);
  19. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15,20,self.vWidth-30,22)];
  20. label.text = @"贵族享受优惠";
  21. label.textAlignment = NSTextAlignmentCenter;
  22. label.textColor = HexColorFromRGB(0xF9F9FF);
  23. label.font = LCBoldFont(19);
  24. [self.baseView addSubview:label];
  25. UIView *baseV = [[UIView alloc] initWithFrame:CGRectMake(14,62, self.vWidth-28,self.youpaipdataArray.count * 35+33)];
  26. baseV.backgroundColor = [UIColor clearColor];
  27. baseV.layer.borderWidth = 0.5;
  28. baseV.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor;
  29. baseV.layer.masksToBounds = YES;
  30. baseV.layer.cornerRadius = 8.0;
  31. self.youpaipbaseV = baseV;
  32. [self.baseView addSubview:baseV];
  33. UIView *itemV = [[UIView alloc] initWithFrame:CGRectMake(0,0, self.vWidth-28,33)];
  34. itemV.backgroundColor = HexColorFromRGB(0xDBA84A);
  35. [baseV addSubview:itemV];
  36. [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:itemV size:CGSizeMake(8.0f, 8.0f)];
  37. NSArray *itemArr = @[@"等级",LCStr(word0),LCStr(word1)];
  38. for (int i = 0; i<3; i++) {
  39. UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0*i,0,(self.vWidth-28)/3.0,33)];
  40. lab.text =itemArr[i];
  41. lab.textAlignment = NSTextAlignmentCenter;
  42. lab.textColor = HexColorFromRGB(0xFFFFFF);
  43. lab.font = LCBoldFont(14);
  44. [itemV addSubview:lab];
  45. if (i>0) {
  46. UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0*i,0,0.5,baseV.frame.size.height)];
  47. line.backgroundColor = HexColorFromRGB(0x4F4B5B);
  48. [self.youpaipbaseV addSubview:line];
  49. }
  50. }
  51. [self youpaifinitUI];
  52. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  53. btn.frame = CGRectMake(29, self.vHeight - 48 - 31,self.vWidth - 29*2, 48);
  54. btn.layer.masksToBounds = YES;
  55. btn.layer.cornerRadius = 24;
  56. btn.titleLabel.font = LCFont(17);
  57. [btn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
  58. [btn setBackgroundImage:[LCTools ColorImage:CGSizeMake(self.vWidth - 29*2, 48) FromColors:@[HexColorFromRGB(0xEFD381),HexColorFromRGB(0xDBA84A)] ByGradientType:1] forState:UIControlStateNormal];
  59. [btn setTitle:@"好的" forState:UIControlStateNormal];
  60. self.youpaipokBtn = btn;
  61. [btn addTarget:self action:@selector(youpaifokBtnAction) forControlEvents:UIControlEventTouchUpInside];
  62. [self.baseView addSubview:btn];
  63. }
  64. -(void)youpaifokBtnAction
  65. {
  66. [self dismissViewControllerAnimated:YES completion:nil];
  67. }
  68. -(void)youpaifinitUI
  69. {
  70. for (int i = 0; i< self.youpaipdataArray.count; i++) {
  71. YOUPAIZYNobleDetailModel *model = self.youpaipdataArray[i];
  72. UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,33+35*i,self.youpaipbaseV.frame.size.width,35)];
  73. [self.youpaipbaseV addSubview:view];
  74. if (i != self.youpaipdataArray.count - 1) {
  75. UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0,34.5,self.youpaipbaseV.frame.size.width,0.5)];
  76. line.backgroundColor = HexColorFromRGB(0x4F4B5B);
  77. [view addSubview:line];
  78. }
  79. UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(6.5, 8, 30, 19)];
  80. // imageV.backgroundColor = [UIColor grayColor];
  81. imageV.contentMode = UIViewContentModeScaleAspectFit;
  82. [imageV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipimg]];
  83. [view addSubview:imageV];
  84. UILabel *lab1 = [[UILabel alloc] initWithFrame:CGRectMake(40.5,0,(self.vWidth-28)/3.0-44.5,35)];
  85. lab1.text = model.youpaipname;
  86. lab1.textColor = HexColorFromRGB(0xFFFFFF);
  87. lab1.font = LCBoldFont(12);
  88. [view addSubview:lab1];
  89. UILabel *lab2 = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0,0,(self.vWidth-28)/3.0,35)];
  90. lab2.text = model.youpaipdis;
  91. lab2.textAlignment = NSTextAlignmentCenter;
  92. lab2.textColor = HexColorFromRGB(0xFFFFFF);
  93. lab2.font = LCBoldFont(12);
  94. [view addSubview:lab2];
  95. UILabel *lab3 = [[UILabel alloc] initWithFrame:CGRectMake((self.vWidth-28)/3.0*2,0,(self.vWidth-28)/3.0,35)];
  96. lab3.text = [NSString stringWithFormat:@"%@钻石",model.youpaipprice];
  97. lab3.textAlignment = NSTextAlignmentCenter;
  98. lab3.textColor = HexColorFromRGB(0xFFFFFF);
  99. lab3.font = LCBoldFont(12);
  100. [view addSubview:lab3];
  101. }
  102. }
  103. @end