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

DRMineUserHintView.m 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // DRMineUserHintView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/11/26.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRMineUserHintView.h"
  9. @implementation DRMineUserHintView
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.layer.masksToBounds = YES;
  14. self.backgroundColor = [UIColor clearColor];
  15. [self initUI];
  16. }
  17. return self;
  18. }
  19. - (void)initUI {
  20. NSArray *arr = @[@"升级到超级会员才有佣金收益,联系客服升级",@"开启消息通知,收益新增、好友新增马上知道",@"请填写微信及二维码,方便下级联系您"];
  21. NSArray *btnArr = @[@"升级",@"开启",@"填写"];
  22. for (int i = 0; i<arr.count; i++) {
  23. UIView *itemBg = [[UIView alloc] init];
  24. itemBg.backgroundColor = [UIColor whiteColor];
  25. itemBg.layer.cornerRadius = 6;
  26. [self addSubview:itemBg];
  27. [itemBg mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.mas_equalTo(10);
  29. make.right.mas_equalTo(-10);
  30. make.top.mas_equalTo(0);
  31. make.height.mas_equalTo(36);
  32. }];
  33. itemBg.tag = 1000+i;
  34. UIImageView *leftNoticeImgView = [[UIImageView alloc] init];
  35. [itemBg addSubview:leftNoticeImgView];
  36. [leftNoticeImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.mas_equalTo(itemBg).mas_offset(FITSIZE(10));
  38. make.centerY.mas_equalTo(itemBg);
  39. make.width.mas_equalTo(FITSIZE(17));
  40. make.height.mas_equalTo(FITSIZE(14));
  41. }];
  42. leftNoticeImgView.image = [UIImage imageNamed:@"我的_通知"];
  43. UILabel *titleLabel = [[UILabel alloc] init];
  44. [itemBg addSubview:titleLabel];
  45. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.mas_equalTo(leftNoticeImgView.mas_right).mas_offset(FITSIZE(6));
  47. make.centerY.mas_equalTo(itemBg);
  48. make.width.mas_greaterThanOrEqualTo(FITSIZE(240));
  49. make.height.mas_equalTo(FITSIZE(17));
  50. }];
  51. titleLabel.text = arr[i];
  52. titleLabel.textColor = [UIColor homeRedColor];
  53. titleLabel.font = [UIFont systemFontOfSize:FITSIZE(12)];
  54. UIButton *startButton = [[UIButton alloc] init];
  55. [startButton setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
  56. startButton.titleLabel.font = [UIFont systemFontOfSize:10];
  57. [startButton setTitle:btnArr[i] forState:UIControlStateNormal];
  58. [itemBg addSubview:startButton];
  59. [startButton mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.right.mas_equalTo(itemBg).mas_offset(FITSIZE(-5));
  61. make.centerY.mas_equalTo(itemBg);
  62. make.width.mas_equalTo(FITSIZE(40));
  63. make.height.mas_equalTo(FITSIZE(18));
  64. }];
  65. startButton.layer.borderWidth = 1;
  66. startButton.layer.borderColor = [UIColor homeRedColor].CGColor;
  67. startButton.layer.cornerRadius = FITSIZE(9);
  68. [startButton.layer masksToBounds];
  69. //点击一整行,都跳转到系统设置
  70. UIButton *maskButton = [[UIButton alloc] init];
  71. maskButton.tag = 1000+i;
  72. [itemBg addSubview:maskButton];
  73. [maskButton mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.edges.mas_equalTo(itemBg);
  75. }];
  76. [maskButton addTarget:self action:@selector(goToAppSystemSetting:) forControlEvents:UIControlEventTouchUpInside];
  77. itemBg.hidden = YES;
  78. }
  79. }
  80. - (void)goToAppSystemSetting:(UIButton *)sender {
  81. if (self.clickBlock) {
  82. self.clickBlock(sender.tag-1000);
  83. }
  84. }
  85. - (void)showUpdate {
  86. UIView *upDateBg = [self viewWithTag:1000+0];
  87. UIView *openBg = [self viewWithTag:1000+1];
  88. UIView *weChatbg = [self viewWithTag:1000+2];
  89. upDateBg.hidden = NO;
  90. openBg.hidden = YES;
  91. weChatbg.hidden = YES;
  92. }
  93. - (void)showOpen {
  94. UIView *upDateBg = [self viewWithTag:1000+0];
  95. UIView *openBg = [self viewWithTag:1000+1];
  96. UIView *weChatbg = [self viewWithTag:1000+2];
  97. upDateBg.hidden = YES;
  98. openBg.hidden = NO;
  99. weChatbg.hidden = YES;
  100. }
  101. - (void)showWechat {
  102. UIView *upDateBg = [self viewWithTag:1000+0];
  103. UIView *openBg = [self viewWithTag:1000+1];
  104. UIView *weChatbg = [self viewWithTag:1000+2];
  105. upDateBg.hidden = YES;
  106. openBg.hidden = YES;
  107. weChatbg.hidden = NO;
  108. }
  109. @end