新UI马甲包

LDSearchCoupleBottomView.m 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. #import "LDSearchCoupleBottomView.h"
  3. @interface LDSearchCoupleBottomView ()
  4. @property (nonatomic, strong) UIButton *searchBtn;
  5. @property (nonatomic, strong) UIButton *shareBtn;
  6. @property (nonatomic, strong) UIButton *payBtn;
  7. @end
  8. @implementation LDSearchCoupleBottomView
  9. - (instancetype)initWithFrame:(CGRect)frame
  10. {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.backgroundColor = [UIColor homeRedColor];
  14. [self initUI];
  15. }
  16. return self;
  17. }
  18. - (void)initUI {
  19. [self addSubview:self.searchBtn];
  20. [self addSubview:self.shareBtn];
  21. [self addSubview:self.payBtn];
  22. }
  23. - (void)showSearch {
  24. self.searchBtn.hidden = NO;
  25. self.shareBtn.hidden = YES;
  26. self.payBtn.hidden = YES;
  27. }
  28. - (void)showPay {
  29. self.searchBtn.hidden = YES;
  30. self.shareBtn.hidden = NO;
  31. self.payBtn.hidden = NO;
  32. }
  33. - (void)searchCouple {
  34. if (self.delegate && [self.delegate respondsToSelector:@selector(bottomViewSearchClick)]) {
  35. [self.delegate bottomViewSearchClick];
  36. }
  37. }
  38. - (void)shareAction {
  39. if (self.delegate && [self.delegate respondsToSelector:@selector(bottomViewShareClick)]) {
  40. [self.delegate bottomViewShareClick];
  41. }
  42. }
  43. - (void)payAction {
  44. if ([self.delegate respondsToSelector:@selector(bottomViewPayClick)]) {
  45. [self.delegate bottomViewPayClick];
  46. }
  47. }
  48. - (UIButton *)searchBtn {
  49. if (!_searchBtn) {
  50. _searchBtn = [[UIButton alloc] initWithFrame:self.bounds];
  51. [_searchBtn setTitle:@"搜券查佣金" forState:UIControlStateNormal];
  52. [_searchBtn setImage:[UIImage imageNamed:@"sousuo"] forState:UIControlStateNormal];
  53. [_searchBtn setButtonImageTitleStyle:ButtonImageTitleStyleLeft padding:7];
  54. _searchBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  55. [_searchBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  56. [_searchBtn addTarget:self action:@selector(searchCouple) forControlEvents:UIControlEventTouchUpInside];
  57. }
  58. return _searchBtn;
  59. }
  60. - (UIButton *)shareBtn {
  61. if (!_shareBtn) {
  62. _shareBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, Fitsize(137), self.height)];
  63. [_shareBtn setTitle:@"分享" forState:UIControlStateNormal];
  64. [_shareBtn setImage:[UIImage imageNamed:@"fenxiang-3"] forState:UIControlStateNormal];
  65. _shareBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  66. _shareBtn.backgroundColor = [UIColor YHColorWithHex:0xFF9402];
  67. [_shareBtn setButtonImageTitleStyle:ButtonImageTitleStyleLeft padding:7];
  68. [_shareBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  69. [_shareBtn addTarget:self action:@selector(shareAction) forControlEvents:UIControlEventTouchUpInside];
  70. }
  71. return _shareBtn;
  72. }
  73. - (UIButton *)payBtn {
  74. if (!_payBtn) {
  75. _payBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.shareBtn.right, 0, self.width-self.shareBtn.width, self.height)];
  76. [_payBtn setTitle:@"立即购买" forState:UIControlStateNormal];
  77. [_payBtn setImage:[UIImage imageNamed:@"quan-2"] forState:UIControlStateNormal];
  78. _payBtn.backgroundColor = [UIColor homeRedColor];
  79. _payBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  80. [_payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  81. [_payBtn setButtonImageTitleStyle:ButtonImageTitleStyleLeft padding:7];
  82. [_payBtn addTarget:self action:@selector(payAction) forControlEvents:UIControlEventTouchUpInside];
  83. }
  84. return _payBtn;
  85. }
  86. @end