123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- //
- // DRMineUserHintView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/11/26.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRMineUserHintView.h"
- @implementation DRMineUserHintView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.layer.masksToBounds = YES;
- self.backgroundColor = [UIColor clearColor];
- [self initUI];
- }
- return self;
- }
- - (void)initUI {
- NSArray *arr = @[@"升级到超级会员才有佣金收益,联系客服升级",@"开启消息通知,收益新增、好友新增马上知道",@"请填写微信及二维码,方便下级联系您"];
- NSArray *btnArr = @[@"升级",@"开启",@"填写"];
-
- for (int i = 0; i<arr.count; i++) {
-
- UIView *itemBg = [[UIView alloc] init];
- itemBg.backgroundColor = [UIColor whiteColor];
- itemBg.layer.cornerRadius = 6;
- [self addSubview:itemBg];
- [itemBg mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.right.mas_equalTo(-10);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(36);
- }];
- itemBg.tag = 1000+i;
- UIImageView *leftNoticeImgView = [[UIImageView alloc] init];
- [itemBg addSubview:leftNoticeImgView];
- [leftNoticeImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(itemBg).mas_offset(FITSIZE(10));
- make.centerY.mas_equalTo(itemBg);
- make.width.mas_equalTo(FITSIZE(17));
- make.height.mas_equalTo(FITSIZE(14));
- }];
- leftNoticeImgView.image = [UIImage imageNamed:@"我的_通知"];
-
- UILabel *titleLabel = [[UILabel alloc] init];
- [itemBg addSubview:titleLabel];
- [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(leftNoticeImgView.mas_right).mas_offset(FITSIZE(6));
- make.centerY.mas_equalTo(itemBg);
- make.width.mas_greaterThanOrEqualTo(FITSIZE(240));
- make.height.mas_equalTo(FITSIZE(17));
- }];
- titleLabel.text = arr[i];
- titleLabel.textColor = [UIColor homeRedColor];
- titleLabel.font = [UIFont systemFontOfSize:FITSIZE(12)];
-
- UIButton *startButton = [[UIButton alloc] init];
- [startButton setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
- startButton.titleLabel.font = [UIFont systemFontOfSize:10];
- [startButton setTitle:btnArr[i] forState:UIControlStateNormal];
- [itemBg addSubview:startButton];
- [startButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(itemBg).mas_offset(FITSIZE(-5));
- make.centerY.mas_equalTo(itemBg);
- make.width.mas_equalTo(FITSIZE(40));
- make.height.mas_equalTo(FITSIZE(18));
- }];
- startButton.layer.borderWidth = 1;
- startButton.layer.borderColor = [UIColor homeRedColor].CGColor;
- startButton.layer.cornerRadius = FITSIZE(9);
- [startButton.layer masksToBounds];
-
- //点击一整行,都跳转到系统设置
- UIButton *maskButton = [[UIButton alloc] init];
- maskButton.tag = 1000+i;
- [itemBg addSubview:maskButton];
- [maskButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.mas_equalTo(itemBg);
- }];
- [maskButton addTarget:self action:@selector(goToAppSystemSetting:) forControlEvents:UIControlEventTouchUpInside];
-
- itemBg.hidden = YES;
- }
-
- }
- - (void)goToAppSystemSetting:(UIButton *)sender {
- if (self.clickBlock) {
- self.clickBlock(sender.tag-1000);
- }
- }
- - (void)showUpdate {
- UIView *upDateBg = [self viewWithTag:1000+0];
- UIView *openBg = [self viewWithTag:1000+1];
- UIView *weChatbg = [self viewWithTag:1000+2];
- upDateBg.hidden = NO;
- openBg.hidden = YES;
- weChatbg.hidden = YES;
- }
- - (void)showOpen {
- UIView *upDateBg = [self viewWithTag:1000+0];
- UIView *openBg = [self viewWithTag:1000+1];
- UIView *weChatbg = [self viewWithTag:1000+2];
- upDateBg.hidden = YES;
- openBg.hidden = NO;
- weChatbg.hidden = YES;
- }
- - (void)showWechat {
- UIView *upDateBg = [self viewWithTag:1000+0];
- UIView *openBg = [self viewWithTag:1000+1];
- UIView *weChatbg = [self viewWithTag:1000+2];
- upDateBg.hidden = YES;
- openBg.hidden = YES;
- weChatbg.hidden = NO;
- }
- @end
|