新UI马甲包

HCShopCarAuthorView.m 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // HCShopCarAuthorView.m
  3. // hc
  4. //
  5. // Created by hc on 2018/11/7.
  6. // Copyright © 2018年 hc. All rights reserved.
  7. //
  8. #import "HCShopCarAuthorView.h"
  9. @implementation HCShopCarAuthorView
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. self.backgroundColor = [UIColor whiteColor];
  15. [self initSubViews];
  16. }
  17. return self;
  18. }
  19. - (void)initSubViews {
  20. UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, Fitsize(28))];
  21. topView.backgroundColor = [UIColor YHColorWithHex:0xFAE0E1];
  22. [self addSubview:topView];
  23. UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(10, Fitsize(8), Fitsize(15), Fitsize(15))];
  24. icon.image = [UIImage imageNamed:@"mijiIcon"];
  25. [topView addSubview:icon];
  26. UILabel *tip = [[UILabel alloc] initWithFrame:CGRectMake(15+Fitsize(15), 0, self.width-25-Fitsize(15), topView.height)];
  27. tip.text = @"省钱秘籍:淘宝购物车里的宝贝有你不知道的隐藏优惠券哦";
  28. tip.textColor = [UIColor YHColorWithHex:0xF4150D];
  29. tip.adjustsFontSizeToFitWidth = YES;
  30. [topView addSubview:tip];
  31. UILabel *text1 = [[UILabel alloc] initWithFrame:CGRectMake(0, Fitsize(90), 0, 0)];
  32. text1.text = @"授权登录";
  33. text1.textColor = [UIColor YHColorWithHex:0x333333];
  34. text1.font = [UIFont systemFontOfSize:16];
  35. [text1 sizeToFit];
  36. text1.centerX = self.centerX;
  37. [self addSubview:text1];
  38. UILabel *text2 = [[UILabel alloc] initWithFrame:CGRectMake(0, Fitsize(90), 0, 0)];
  39. text2.text = @"发现你淘宝购物车里的隐藏优惠券";
  40. text2.textColor = [UIColor YHColorWithHex:0x333333];
  41. text2.font = [UIFont systemFontOfSize:16];
  42. [text2 sizeToFit];
  43. text2.y = text1.bottom+5;
  44. text2.centerX = self.centerX;
  45. [self addSubview:text2];
  46. UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Fitsize(180), Fitsize(180)*281/331)];
  47. imgView.image = [UIImage imageNamed:@"authorQuan"];
  48. imgView.contentMode = UIViewContentModeScaleAspectFill;
  49. imgView.y = text2.bottom+Fitsize(40);
  50. imgView.centerX = self.centerX;
  51. [self addSubview:imgView];
  52. UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, imgView.bottom+Fitsize(30), Fitsize(160), Fitsize(36))];
  53. [btn setTitle:@"授权登录" forState:UIControlStateNormal];
  54. [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  55. btn.backgroundColor = [UIColor homeRedColor];
  56. btn.layer.cornerRadius = Fitsize(18);
  57. btn.titleLabel.font = [UIFont systemFontOfSize:16];
  58. [btn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
  59. btn.centerX = self.centerX;
  60. [self addSubview:btn];
  61. }
  62. - (void)clickBtn {
  63. if (self.clickBlock) {
  64. self.clickBlock();
  65. }
  66. }
  67. @end