《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRMineBlanceView.m 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // DRMineBlanceView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/17.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRMineBlanceView.h"
  9. @interface DRMineBlanceView()
  10. @property (nonatomic, strong) UILabel *priceLabel;
  11. @property (nonatomic, strong) UILabel *todayMoneyLabel;
  12. @property (nonatomic, strong) UIImageView *rightArrow;//
  13. @end
  14. @implementation DRMineBlanceView
  15. - (instancetype)initWithFrame:(CGRect)frame {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. self.backgroundColor = [UIColor whiteColor];
  19. self.layer.cornerRadius = 6;
  20. [self initSubViews];
  21. // self.layer.shadowColor = [UIColor homeRedColor].CGColor;
  22. // self.layer.shadowOffset = CGSizeMake(0, 0);
  23. // self.layer.shadowOpacity = 0.3;
  24. // self.layer.shadowRadius = 3;
  25. }
  26. return self;
  27. }
  28. -(void)moneyAction{
  29. if (self.moneyBlock) {
  30. self.moneyBlock();
  31. }
  32. }
  33. -(void)setTodayMoney:(NSString *)todayMoney {
  34. _todayMoney = todayMoney;
  35. if (todayMoney.length <= 0 || [todayMoney isEqualToString:@"0.00"]) {
  36. self.todayMoneyLabel.text = @"";
  37. }else {
  38. self.todayMoneyLabel.text = [NSString stringWithFormat:@"+¥%@",todayMoney];
  39. }
  40. }
  41. - (void)setBlancePrice:(NSString *)blance {
  42. self.priceLabel.text = [NSString stringWithFormat:@"¥%@",blance];
  43. }
  44. - (void)initSubViews {
  45. UIView *alphaView = [[UIView alloc] initWithFrame:self.bounds];
  46. alphaView.backgroundColor = [UIColor clearColor];
  47. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(moneyAction)];
  48. [alphaView addGestureRecognizer:tap];
  49. [self addSubview:alphaView];
  50. UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 60, 30)];
  51. title.centerY = self.height/2;
  52. title.text = @"我的收益";
  53. title.font = [UIFont systemFontOfSize:14];
  54. [self addSubview:title];
  55. self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(title.right+21, 0, 200, 30)];
  56. self.priceLabel.centerY = title.centerY;
  57. self.priceLabel.textColor = [UIColor homeRedColor];
  58. self.priceLabel.text = @"-.--";
  59. self.priceLabel.font = [UIFont systemFontOfSize:24];
  60. [self addSubview:self.priceLabel];
  61. self.todayMoneyLabel = [[UILabel alloc] init];
  62. [self addSubview:self.todayMoneyLabel];
  63. [self.todayMoneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.right.mas_equalTo(self).mas_offset(FITSIZE(-36));
  65. make.width.mas_greaterThanOrEqualTo(FITSIZE(60));
  66. make.height.mas_greaterThanOrEqualTo(FITSIZE(20));
  67. make.centerY.mas_equalTo(title);
  68. }];
  69. self.todayMoneyLabel.textColor = [UIColor homeRedColor];
  70. self.todayMoneyLabel.font = [UIFont systemFontOfSize:14];
  71. self.todayMoneyLabel.textAlignment = NSTextAlignmentRight;
  72. self.rightArrow = [[UIImageView alloc] init];
  73. [self addSubview:self.rightArrow];
  74. [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.mas_equalTo(self.todayMoneyLabel.mas_right).mas_offset(FITSIZE(11));
  76. make.centerY.mas_equalTo(title);
  77. make.width.mas_greaterThanOrEqualTo(FITSIZE(7));
  78. make.height.mas_greaterThanOrEqualTo(FITSIZE(11));
  79. }];
  80. self.rightArrow.image = [UIImage imageNamed:@"fanhui_右箭头"];
  81. UIButton *moneyBtn = [[UIButton alloc] init];
  82. [moneyBtn addTarget:self action:@selector(moneyAction) forControlEvents:UIControlEventTouchUpInside];
  83. [self addSubview:moneyBtn];
  84. [moneyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.edges.mas_equalTo(self);
  86. }];
  87. }
  88. @end