口袋优选

KBMineBlanceView.m 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // KBMineBlanceView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/17.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBMineBlanceView.h"
  9. @interface KBMineBlanceView()
  10. @property (nonatomic, strong) UILabel *priceLabel;
  11. @end
  12. @implementation KBMineBlanceView
  13. - (instancetype)initWithFrame:(CGRect)frame {
  14. self = [super initWithFrame:frame];
  15. if (self) {
  16. self.backgroundColor = [UIColor whiteColor];
  17. self.layer.cornerRadius = 6;
  18. self.layer.masksToBounds = YES;
  19. [self initSubViews];
  20. }
  21. return self;
  22. }
  23. -(void)moneyAction{
  24. if (self.moneyBlock) {
  25. self.moneyBlock();
  26. }
  27. }
  28. - (void)setBlancePrice:(NSString *)blance {
  29. self.priceLabel.text = [NSString stringWithFormat:@"¥%@",blance];
  30. }
  31. - (void)initSubViews {
  32. UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 60, 30)];
  33. title.centerY = self.height/2;
  34. title.text = @"账户余额";
  35. title.font = [UIFont systemFontOfSize:14];
  36. [self addSubview:title];
  37. self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(title.right+21, 0, 200, 30)];
  38. self.priceLabel.centerY = title.centerY;
  39. self.priceLabel.textColor = [UIColor homeRedColor];
  40. self.priceLabel.text = @"-.--";
  41. self.priceLabel.font = [UIFont systemFontOfSize:24];
  42. [self addSubview:self.priceLabel];
  43. UIButton *moneyBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-17-44, 0, 44, 20)];
  44. moneyBtn.layer.borderWidth = 1;
  45. moneyBtn.layer.borderColor = [UIColor homeRedColor].CGColor;
  46. moneyBtn.layer.cornerRadius = 10;
  47. moneyBtn.centerY = self.priceLabel.centerY;
  48. moneyBtn.titleLabel.font = [UIFont systemFontOfSize:10];
  49. [moneyBtn setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
  50. [moneyBtn setTitle:@"提现" forState:UIControlStateNormal];
  51. [moneyBtn addTarget:self action:@selector(moneyAction) forControlEvents:UIControlEventTouchUpInside];
  52. [self addSubview:moneyBtn];
  53. }
  54. @end