YOUPAILCSkillView.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. //
  2. // YOUPAILCSkillView.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/9/13.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCSkillView.h"
  9. @interface YOUPAILCSkillView()
  10. @property(nonatomic,strong)YOUPAILCSkillModel* youpaipskillModel;
  11. @property(nonatomic,strong)UIImageView* youpaipiconImgV;
  12. @end
  13. @implementation YOUPAILCSkillView
  14. - (instancetype)initWithFrame:(CGRect)frame skillModel:(YOUPAILCSkillModel*)model{
  15. if (self = [super initWithFrame:frame]) {
  16. self.youpaipskillModel = model;
  17. [self youpaifsetupView];
  18. }
  19. return self;
  20. }
  21. - (void)youpaifsetupView{
  22. self.layer.cornerRadius = 5;
  23. self.layer.masksToBounds = YES;
  24. self.backgroundColor = HexColorFromRGB(0x2A2935);
  25. UIImageView *iconImgView = [[UIImageView alloc] init];
  26. [self addSubview:iconImgView];
  27. [iconImgView makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.equalTo(self.left).offset(12);
  29. // make.top.equalTo(self.top).offset(@18);
  30. make.centerY.equalTo(self.centerY);
  31. make.height.equalTo(@48);
  32. make.width.equalTo(@48);
  33. }];
  34. [iconImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipskillModel.youpaipicon]];
  35. UILabel* label = [[UILabel alloc]init];
  36. label.textColor = [UIColor whiteColor];
  37. label.font = LCFont(14);
  38. label.text = [NSString stringWithFormat:@"技能:%@",self.youpaipskillModel.youpaipname];
  39. [self addSubview:label];
  40. [label makeConstraints:^(MASConstraintMaker *make) {
  41. make.left.equalTo(iconImgView.right).offset(10.0f);
  42. make.top.equalTo(iconImgView.top).offset(4.0f);
  43. make.height.equalTo(@17);
  44. }];
  45. UILabel* valueLab = [[UILabel alloc]init];
  46. valueLab.textColor = [UIColor whiteColor];
  47. valueLab.font = LCFont(14);
  48. valueLab.text = [NSString stringWithFormat:@" %@钻石/分钟",self.youpaipskillModel.youpaipprice];
  49. [self addSubview:valueLab];
  50. [valueLab makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.equalTo(iconImgView.right).offset(10.0f);
  52. make.bottom.equalTo(iconImgView.bottom).offset(-4.0f);
  53. make.height.equalTo(@17);
  54. }];
  55. // UILabel* praiseLab = [[UILabel alloc]init];
  56. // praiseLab.textColor = HexColorFromRGB(0x999999);
  57. // praiseLab.font = LCFont(12);
  58. // praiseLab.text = [NSString stringWithFormat:@"评分: %@分",self.skillModel.score];
  59. // [self addSubview:praiseLab];
  60. // [praiseLab makeConstraints:^(MASConstraintMaker *make) {
  61. // make.left.equalTo(iconImgView.right).offset(@8);
  62. // make.top.equalTo(label.bottom).offset(@4);
  63. // make.height.equalTo(@15);
  64. // }];
  65. NobleSaleBtn* nobleSaleBtn = [[NobleSaleBtn alloc]init];
  66. self.youpaipnobleSaleBtn = nobleSaleBtn;
  67. [self addSubview:nobleSaleBtn];
  68. [nobleSaleBtn makeConstraints:^(MASConstraintMaker *make) {
  69. make.right.offset(-18);
  70. make.top.offset(22);
  71. make.size.mas_offset(CGSizeMake(65.0f, 13.0f));
  72. }];
  73. UIButton* priceBtn = [[UIButton alloc]init];
  74. priceBtn.titleLabel.font = LCFont12;
  75. [priceBtn setTitle:@"修改价格" forState:(UIControlStateNormal)];
  76. [priceBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  77. priceBtn.backgroundColor = HexColorFromRGB(0x4F4B5B);
  78. priceBtn.layer.cornerRadius = 13.5f;
  79. priceBtn.clipsToBounds = YES;
  80. // priceBtn.hidden = YES;
  81. self.youpaippriceBtn = priceBtn;
  82. [self addSubview:priceBtn];
  83. [priceBtn makeConstraints:^(MASConstraintMaker *make) {
  84. make.right.offset(-12);
  85. make.top.equalTo(nobleSaleBtn.bottom).offset(5.0f);
  86. make.size.mas_offset(CGSizeMake(74.0f, 26.0f));
  87. }];
  88. }
  89. @end
  90. @implementation NobleSaleBtn
  91. - (instancetype)initWithFrame:(CGRect)frame {
  92. if (self = [super initWithFrame:frame]) {
  93. [self youpaifsetupView];
  94. }
  95. return self;
  96. }
  97. - (void)youpaifsetupView{
  98. self.youpaipbtnL = [[UILabel alloc]init];
  99. self.youpaipbtnL.textColor = HexColorFromRGB(0xFFCF54);
  100. self.youpaipbtnL.font = LCFont(11.0f);
  101. self.youpaipbtnL.textAlignment = NSTextAlignmentRight;
  102. self.youpaipbtnL.text = @"贵族优惠";
  103. [self addSubview:self.youpaipbtnL];
  104. [self.youpaipbtnL mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.left.offset(0.0f);
  106. make.bottom.offset(0.0f);
  107. make.top.offset(0.0f);
  108. make.right.offset(-14.0f);
  109. }];
  110. self.youpaipiconimgV = [[UIImageView alloc]init];
  111. self.youpaipiconimgV.image = [UIImage imageNamed:@"vqu_images_game_arrow"];
  112. self.youpaipiconimgV.contentMode = UIViewContentModeScaleAspectFill;
  113. [self addSubview:self.youpaipiconimgV];
  114. [self.youpaipiconimgV mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.right.bottom.offset(0.0f);
  116. make.size.mas_offset(CGSizeMake(13, 13));
  117. }];
  118. }
  119. @end