123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- //
- // YOUPAIProfileMenuItemContentCell.m
- // MSYOUPAI
- //
- // Created by xiaohaoran on 2022/3/7.
- // Copyright © 2022 MS. All rights reserved.
- //
- #import "YOUPAIProfileMenuItemContentCell.h"
- #import "YOUPAIHRMedalView.h"
- @implementation YOUPAIProfileMenuItemContentCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
-
- [self youpaifinitialValue];
-
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitialValue{
- self.youpaiplz_accessoryType = LZTableViewCellAccessoryNone;
- }
- -(void)setYoupaipisShow:(NSString*)isShow{
-
- _youpaipisShow = isShow;
- if ([self.youpaipisShow isEqualToString:@"1"]) {
- self.youpaipredView.hidden = NO;
- }else{
- self.youpaipredView.hidden = YES;
- }
- }
- - (void)youpaifinitUI{
-
-
- self.youpaipimgV = [[UIImageView alloc] init];
- [self.contentView addSubview:self.youpaipimgV];
- [self.youpaipimgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(13.0f);
- make.centerY.mas_equalTo(0);
- make.width.height.offset(32.0f);
- }];
-
- self.youpaiptextL = [[UILabel alloc] init];
- self.youpaiptextL.font = LCFont(14.0f);
- self.youpaiptextL.textColor = LZ273145Color;
- [self.contentView addSubview:self.youpaiptextL];
- [self.youpaiptextL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.youpaipimgV.mas_right).offset(7.0f);
- make.centerY.mas_equalTo(0);
- }];
-
-
- self.youpaipsubTextL = [[UILabel alloc] init];
- self.youpaipsubTextL.font = LCFont(12.0f);
- self.youpaipsubTextL.textColor = HexColorFromRGB(0x9F9DA5);
- [self.contentView addSubview:self.youpaipsubTextL];
- [self.youpaipsubTextL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.youpaiptextL.mas_right).offset(3.0f);
- make.centerY.mas_equalTo(0);
- }];
-
- self.youpaiprightArrowImgV = [[UIImageView alloc] init];
- self.youpaiprightArrowImgV.image = [UIImage imageNamed:@"vqu_images_D_profile_item_arrow1"];
- self.youpaiprightArrowImgV.hidden = YES;
- [self.contentView addSubview:self.youpaiprightArrowImgV];
- [self.youpaiprightArrowImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-13.0f);
- make.width.height.offset(10.0f);
- make.centerY.equalTo(0);
- }];
- self.youpaiprightLabel = [[UILabel alloc] init];
- self.youpaiprightLabel.font = LCFont(12.0f);
- self.youpaiprightLabel.textColor = HexColorFromRGB(0x9F9DA5);
- [self.contentView addSubview:self.youpaiprightLabel];
- [self.youpaiprightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.youpaiprightArrowImgV.mas_left).offset(-10.0f);
- make.centerY.equalTo(0);
- }];
- self.youpaiprightLabel.hidden = YES;
- self.youpaiprightSwitch = [UIButton buttonWithType:UIButtonTypeCustom];
- [self.youpaiprightSwitch setImage:[UIImage imageNamed:@"vqu_images_ic_profile_siwch_on"] forState:UIControlStateSelected];
- [self.youpaiprightSwitch setImage:[UIImage imageNamed:@"vqu_images_ic_profile_siwch_off"] forState:UIControlStateNormal];
- self.youpaiprightSwitch.hidden = YES;
- [self.contentView addSubview:self.youpaiprightSwitch];
-
- [self.youpaiprightSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-20.0f);
- make.centerY.equalTo(0);
- make.size.mas_offset(CGSizeMake(27.5f, 44.0f));
- }];
-
- UIView *line = [[UIView alloc] init];
- self.line = line;
- line.backgroundColor = LZF5F4F7Color;
- [self.contentView addSubview:line];
- [line mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(2.0f);
- make.right.offset(-2.0f);
- make.height.offset(0.5f);
- make.bottom.offset(0.0f);
- }];
- YOUPAILCBaseInfo *userinfo = [LCSaveModel getUserModel].youpaipuserinfo;
- self.youpaiprightWidth = 54;
- CGFloat width = 0;
- for (int i =0 ; i<userinfo.youpaipbadge_all.count; i++) {
- YOUPAILZVipCarModel *model = userinfo.youpaipbadge_all[i];
- width+=[model.youpaipwidth floatValue];
- self.youpaiprightWidth += [model.youpaipwidth floatValue];
- }
- YOUPAIHRMedalView *righMedaltView = [YOUPAIHRMedalView new];
- self.youpaiprighMedaltView = righMedaltView;
- [self.contentView addSubview:righMedaltView];
- [righMedaltView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(0);
- make.right.equalTo(self.youpaiprightArrowImgV.mas_left).offset(-10.0f);
- make.size.mas_equalTo(CGSizeMake(width+5, 15));
- }];
- righMedaltView.youpaipinfoModel = userinfo;
- righMedaltView.hidden = YES;
-
- //未读红点
- UIView *redView = [UIView new];
- self.youpaipredView = redView;
- [self addSubview:redView];
- [redView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-40);
- make.centerY.mas_equalTo(righMedaltView);
- make.size.mas_equalTo(CGSizeMake(4, 4));
- }];
- redView.layer.cornerRadius = 2;
- redView.layer.masksToBounds = YES;
- redView.backgroundColor = LCRedColor;
- redView.hidden = YES;
-
- }
- - (void)setYoupaiplz_accessoryType:(LZTableViewCellAccessoryType)lz_accessoryType{
- self.youpaiprightSwitch.hidden = YES;
- self.youpaiprightArrowImgV.hidden = YES;
-
- _youpaiplz_accessoryType = lz_accessoryType;
- switch (lz_accessoryType) {
- case LZTableViewCellAccessoryNone:
- break;
- case LZTableViewCellAccessoryDisclosureIndicator:
- {
- self.youpaiprightArrowImgV.hidden = NO;
- }
- break;
- case LZTableViewCellAccessorySwitch:
- {
- self.youpaiprightSwitch.hidden = NO;
- }
- break;
- case LZTableViewCellAccessoryRightTitle:
- {
- self.youpaiprightLabel.hidden = NO;
- self.youpaiprightArrowImgV.hidden = NO;
- }
- break;
- case LZTableViewCellAccessoryRightImage:
- {
- self.youpaiprighMedaltView.hidden = NO;
- self.youpaiprightArrowImgV.hidden = NO;
- [self.youpaipredView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-self.youpaiprightWidth);
- }];
-
- }
- break;
-
-
-
- default:
- break;
- }
- }
- @end
|