MGLiveRechargeCell.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // MGLiveRechargeCell.m
  3. // BuguLive
  4. //
  5. // Created by 宋晨光 on 2020/8/5.
  6. // Copyright © 2020 xfg. All rights reserved.
  7. //
  8. #import "MGLiveRechargeCell.h"
  9. @implementation MGLiveRechargeCell
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. // self.contentView.backgroundColor = kRandomFlatColor;
  14. [self initUI];
  15. }
  16. return self;
  17. }
  18. -(void)initUI{
  19. self.control = [[UIControl alloc]initWithFrame:CGRectMake(0, 0, self.width, self.height)];
  20. self.control.layer.cornerRadius = 4;
  21. self.control.layer.masksToBounds = YES;
  22. self.control.layer.borderColor = kBlueColor.CGColor;
  23. self.control.layer.borderWidth = 0.5f;
  24. UILabel *titleL = [[UILabel alloc]initWithFrame:CGRectMake(0, kRealValue(5), self.width, kRealValue(20))];
  25. titleL.textAlignment = NSTextAlignmentCenter;
  26. titleL.font = [UIFont systemFontOfSize:15];
  27. titleL.textColor = kBlueColor;
  28. _titleL = titleL;
  29. UILabel *subtitleL = [[UILabel alloc]initWithFrame:CGRectMake(0, titleL.bottom + kRealValue(5), self.width, kRealValue(20))];
  30. subtitleL.textAlignment = NSTextAlignmentCenter;
  31. subtitleL.font = [UIFont systemFontOfSize:13];
  32. subtitleL.textColor = kGrayColor;
  33. _subTitleL = subtitleL;
  34. [self.control addSubview:self.titleL];
  35. [self.control addSubview:self.subTitleL];
  36. [self.contentView addSubview:self.control];
  37. }
  38. -(void)resetViewWithModel:(PayMoneyModel *)model{
  39. self.titleL.text = [NSString stringWithFormat:ASLocalizedString(@"%ld钻石"),model.diamonds];
  40. self.subTitleL.text = [NSString stringWithFormat:ASLocalizedString(@"售价:%@"),model.money_name];
  41. }
  42. @end