No Description

FKWantBuyEmptyView.m 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. //
  2. // FKWantBuyFirstController.m
  3. // FirstLink
  4. //
  5. // Created by 施昌鹏 on 16/8/17.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKWantBuyEmptyView.h"
  9. @interface FKWantBuyEmptyView ()
  10. @property (nonatomic, strong) UIView *fieldBgView;
  11. @property (nonatomic, strong) UIView *leftDivideView;
  12. @property (nonatomic, strong) UIView *rightDivideView;
  13. @property (nonatomic, strong) UILabel *showLabel;
  14. @property (nonatomic, strong) UIImageView *brandImageview;
  15. @property (nonatomic, strong) UIImageView *banenrImageView;
  16. @end
  17. @implementation FKWantBuyEmptyView
  18. - (instancetype)initWithFrame:(CGRect)frame {
  19. self = [super initWithFrame:frame];
  20. if (self) {
  21. [self addAllSubviews];
  22. [self addTapGesture];
  23. }
  24. return self;
  25. }
  26. - (void)addTapGesture{
  27. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self
  28. action:@selector(tapGestureClick:)];
  29. [self addGestureRecognizer:tap];
  30. }
  31. -(void)addAllSubviews {
  32. [self addSubview:self.banenrImageView];
  33. [self addSubview:self.fieldBgView];
  34. [self addSubview:self.buyButton];
  35. [self addSubview:self.leftDivideView];
  36. [self addSubview:self.rightDivideView];
  37. [self addSubview:self.showLabel];
  38. [self addSubview:self.brandImageview];
  39. [self.fieldBgView addSubview:self.textField];
  40. CGFloat banerH = UISCREENWIDTH * 360.0 / 751.0;
  41. [self.banenrImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.right.top.equalTo(self);
  43. make.height.mas_equalTo(banerH);
  44. }];
  45. [self.fieldBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.equalTo(self).offset(25);
  47. make.right.equalTo(self).offset(- 25);
  48. make.top.equalTo(self.banenrImageView.mas_bottom).offset(25);
  49. make.height.mas_equalTo(40);
  50. }];
  51. [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.top.bottom.right.equalTo(self.fieldBgView);
  53. make.left.equalTo(self.fieldBgView).offset(9);
  54. }];
  55. [self.buyButton mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.top.equalTo(self.fieldBgView.mas_bottom).offset(20);
  57. make.left.right.equalTo(self.fieldBgView);
  58. make.height.mas_equalTo(40);
  59. }];
  60. [self.showLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.centerX.equalTo(self);
  62. make.top.equalTo(self.buyButton.mas_bottom).offset(35);
  63. }];
  64. [self.leftDivideView mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.right.equalTo(self.showLabel.mas_left).offset(-5);
  66. make.centerY.equalTo(self.showLabel);
  67. make.height.mas_equalTo(0.5);
  68. make.left.equalTo(self.fieldBgView);
  69. }];
  70. [self.rightDivideView mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.equalTo(self.showLabel.mas_right).offset(5);
  72. make.centerY.equalTo(self.showLabel);
  73. make.height.mas_equalTo(0.5);
  74. make.right.equalTo(self.fieldBgView);
  75. }];
  76. [self.brandImageview mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.top.equalTo(self.showLabel.mas_bottom).offset(30);
  78. make.left.equalTo(self).offset(20);
  79. make.right.equalTo(self).offset(-20);
  80. }];
  81. }
  82. #pragma mark - Action
  83. - (void)tapGestureClick:(UIGestureRecognizer *)sender{
  84. [self endEditing:YES];
  85. }
  86. #pragma mark - Property
  87. -(UIImageView *)banenrImageView {
  88. if (_banenrImageView == nil) {
  89. _banenrImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"banenr"]];
  90. }
  91. return _banenrImageView;
  92. }
  93. -(UIView *)fieldBgView {
  94. if (_fieldBgView == nil) {
  95. _fieldBgView = [[UIView alloc] init];
  96. _fieldBgView.backgroundColor = UIColorFromRGB(0xffffff);
  97. _fieldBgView.layer.borderWidth = 0.5;
  98. _fieldBgView.layer.borderColor = UIColorFromRGB(0x999999).CGColor;
  99. _fieldBgView.layer.cornerRadius = 4;
  100. }
  101. return _fieldBgView;
  102. }
  103. -(UITextField *)textField {
  104. if (_textField == nil) {
  105. _textField = [[UITextField alloc] init];
  106. _textField.borderStyle = UITextBorderStyleNone;
  107. _textField.placeholder = @"输入海外网站商品链接";
  108. _textField.font = [UIFont systemFontOfSize:14];
  109. _textField.textColor = UIColorFromRGB(0x999999);
  110. _textField.clearButtonMode = UITextFieldViewModeAlways;
  111. _textField.returnKeyType = UIReturnKeyDone;
  112. }
  113. return _textField;
  114. }
  115. -(UIButton *)buyButton {
  116. if (_buyButton == nil) {
  117. _buyButton = [UIButton buttonWithType:UIButtonTypeCustom];
  118. _buyButton.backgroundColor = UIColorFromRGB(0xf8bf75);
  119. _buyButton.titleLabel.font = [UIFont systemFontOfSize:15];
  120. [_buyButton setTitleColor:UIColorFromRGB(0xffffff) forState:UIControlStateNormal];
  121. [_buyButton setTitle:@"我要买" forState:UIControlStateNormal];
  122. _buyButton.layer.cornerRadius = 4;
  123. }
  124. return _buyButton;
  125. }
  126. -(UILabel *)showLabel {
  127. if (_showLabel == nil) {
  128. _showLabel = [[UILabel alloc] init];
  129. _showLabel.font = [UIFont systemFontOfSize:14];
  130. _showLabel.textColor = UIColorFromRGB(0x333333);
  131. _showLabel.text = @"支持网站";
  132. }
  133. return _showLabel;
  134. }
  135. -(UIView *)leftDivideView {
  136. if (_leftDivideView == nil) {
  137. _leftDivideView = [[UIView alloc] init];
  138. _leftDivideView.backgroundColor = UIColorFromRGB(0xe5e5e5);
  139. }
  140. return _leftDivideView;
  141. }
  142. -(UIView *)rightDivideView {
  143. if (_rightDivideView == nil) {
  144. _rightDivideView = [[UIView alloc] init];
  145. _rightDivideView.backgroundColor = UIColorFromRGB(0xe5e5e5);
  146. }
  147. return _rightDivideView;
  148. }
  149. -(UIImageView *)brandImageview {
  150. if (_brandImageview == nil) {
  151. _brandImageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"brand"]];
  152. _brandImageview.contentMode = UIViewContentModeScaleAspectFit;
  153. }
  154. return _brandImageview;
  155. }
  156. @end