酷店

KDPEarningHeadView.m 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. //
  2. // KDPEarningHeadView.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPEarningHeadView.h"
  9. @implementation KDPEarningHeadView
  10. -(instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self=[super initWithFrame:frame];
  13. if (self) {
  14. [self initEarnUI];
  15. }
  16. return self;
  17. }
  18. -(void)initEarnUI
  19. {
  20. UIImageView *backImgV=[[UIImageView alloc]init];
  21. backImgV.image=[UIImage imageNamed:@"mine_back_icon"];
  22. [self addSubview:backImgV];
  23. [backImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.left.top.right.bottom.mas_equalTo(0);
  25. ;
  26. }];
  27. [UIApplication sharedApplication].statusBarStyle=UIStatusBarStyleLightContent;
  28. [backImgV addSubview:self.headImgBtn];
  29. [self.headImgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.left.mas_equalTo(10);
  31. make.top.mas_equalTo(KDStatusHeight+4);
  32. make.height.width.mas_equalTo(32);
  33. }];
  34. UIImageView *imgv=[[UIImageView alloc]initWithFrame:CGRectMake(2, 2, 28, 28)];
  35. imgv.layer.cornerRadius=14;
  36. imgv.layer.masksToBounds=YES;
  37. KDPAccountModel *model=[KDPAccountTool account];
  38. [imgv sd_setImageWithURL:[NSURL URLWithString:model.img]placeholderImage:[UIImage imageNamed:placholderImg]];
  39. [self.headImgBtn addSubview:imgv];
  40. UIImageView *imgV=[[UIImageView alloc]init];
  41. imgV.image=[UIImage imageNamed:@"LIVE"];
  42. [backImgV addSubview:imgV];
  43. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.left.mas_equalTo(self.headImgBtn.mas_left).offset(5);
  45. make.width.mas_equalTo(22);
  46. make.height.mas_equalTo(9);
  47. make.top.mas_equalTo(self.headImgBtn.mas_bottom).offset(-7);
  48. }];
  49. UILabel *titleL =[[UILabel alloc]initWithFrame:CGRectMake(50, KDStatusHeight, SCREEN_WIDTH-100, 44)];
  50. titleL.textAlignment=NSTextAlignmentCenter;
  51. titleL.text=@"我的收益";
  52. titleL.font=[UIFont systemFontOfSize:17];
  53. titleL.textColor=[UIColor whiteColor];
  54. [backImgV addSubview:titleL];
  55. backImgV.userInteractionEnabled=YES;
  56. [backImgV addSubview:self.orderNumgL];
  57. [backImgV addSubview:self.Forecastlabel];
  58. [self.orderNumgL mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.left.mas_equalTo(0);
  60. make.top.mas_equalTo(KDStatusHeight+66);
  61. make.height.mas_equalTo(42);
  62. make.width.mas_equalTo(SCREEN_WIDTH/2);
  63. }];
  64. [self.Forecastlabel mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.mas_equalTo(self.orderNumgL.mas_right);
  66. make.top.mas_equalTo(KDStatusHeight+66);
  67. make.height.mas_equalTo(42);
  68. make.width.mas_equalTo(SCREEN_WIDTH/2);
  69. }];
  70. UILabel *ordertitleL=[[UILabel alloc]init];
  71. ordertitleL.text=@"预估订单量";
  72. ordertitleL.font=[UIFont systemFontOfSize:12];
  73. ordertitleL.textColor=[UIColor whiteColor];
  74. ordertitleL.textAlignment=NSTextAlignmentCenter;
  75. [backImgV addSubview:ordertitleL];
  76. [ordertitleL mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.left.mas_equalTo(0);
  78. make.top.mas_equalTo(self.orderNumgL.mas_bottom).offset(6);
  79. make.height.mas_equalTo(17);
  80. make.width.mas_equalTo(SCREEN_WIDTH/2);
  81. }];
  82. UILabel *eariLabel=[[UILabel alloc]init];
  83. eariLabel.text=@"预估收益>";
  84. UITapGestureRecognizer *getst=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickIncomeforeCast)];
  85. eariLabel.userInteractionEnabled=YES;
  86. [eariLabel addGestureRecognizer:getst];
  87. eariLabel.font=[UIFont systemFontOfSize:12];
  88. eariLabel.textColor=[UIColor whiteColor];
  89. eariLabel.textAlignment=NSTextAlignmentCenter;
  90. [backImgV addSubview:eariLabel];
  91. [eariLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.left.mas_equalTo(self.Forecastlabel.mas_left);
  93. make.top.mas_equalTo(self.Forecastlabel.mas_bottom).offset(6);
  94. make.height.mas_equalTo(17);
  95. make.width.mas_equalTo(SCREEN_WIDTH/2);
  96. }];
  97. }
  98. #pragma mark---预估收益
  99. -(void)clickIncomeforeCast{
  100. if (self.forecastBlock) {
  101. self.forecastBlock();
  102. }
  103. }
  104. #pragma mark---页面布局
  105. -(UIButton *)headImgBtn
  106. {
  107. if (!_headImgBtn) {
  108. _headImgBtn=[[UIButton alloc]init];
  109. _headImgBtn.backgroundColor=[UIColor colorWithHexString:ThemeColor];
  110. _headImgBtn.layer.cornerRadius=16;
  111. _headImgBtn.layer.masksToBounds=YES;
  112. _headImgBtn.layer.borderColor=[UIColor colorWithHexString:@"#FFB444"].CGColor;
  113. _headImgBtn.layer.borderWidth=1;
  114. [_headImgBtn addTarget:self action:@selector(drawerClickButton) forControlEvents:UIControlEventTouchUpInside];
  115. _headImgBtn.adjustsImageWhenHighlighted=NO;
  116. }
  117. return _headImgBtn;
  118. }
  119. -(UIButton *)todayButton
  120. {
  121. if (!_todayButton) {
  122. _todayButton=[[UIButton alloc]init];
  123. [_todayButton setImage:[UIImage imageNamed:@"today_icon"] forState:UIControlStateNormal];
  124. _todayButton.adjustsImageWhenHighlighted=NO;
  125. [_todayButton addTarget:self action:@selector(todayclickButton) forControlEvents:UIControlEventTouchUpInside];
  126. }
  127. return _todayButton;
  128. }
  129. -(UILabel *)orderNumgL
  130. {
  131. if (!_orderNumgL) {
  132. _orderNumgL=[[UILabel alloc]init];
  133. _orderNumgL.text=@"----";
  134. _orderNumgL.font=[UIFont boldSystemFontOfSize:30];
  135. _orderNumgL.textColor=[UIColor whiteColor];
  136. _orderNumgL.textAlignment=NSTextAlignmentCenter;
  137. }
  138. return _orderNumgL;
  139. }
  140. -(UILabel *)Forecastlabel
  141. {
  142. if (!_Forecastlabel) {
  143. _Forecastlabel=[[UILabel alloc]init];
  144. _Forecastlabel.text=@"----";
  145. _Forecastlabel.font=[UIFont boldSystemFontOfSize:30];
  146. _Forecastlabel.textColor=[UIColor whiteColor];
  147. _Forecastlabel.textAlignment=NSTextAlignmentCenter;
  148. }
  149. return _Forecastlabel;
  150. }
  151. #pragma mark---侧滑
  152. -(void)drawerClickButton
  153. {
  154. if (self.drawcBlock) {
  155. self.drawcBlock();
  156. }
  157. }
  158. #pragma mark---消息中心
  159. -(void)todayclickButton
  160. {
  161. }
  162. @end