// // HDLFVNormalCellView.m // Ezviz // // Created by 陈启扬 on 2022/4/25. // Copyright © 2022 hdl. All rights reserved. // #import "HDLEZNormalCellView.h" @interface HDLEZNormalCellView () @property (nonatomic, strong)UIImageView *nextImgV;//箭头图标 @end @implementation HDLEZNormalCellView -(instancetype)init{ self = [super init]; if (self) { [self initUI]; } return self; } -(void)initUI{ self.backgroundColor=HDLEZ_COLOR_VIEW_FOREGROUND; //标题lable _titleL=[[UILabel alloc] init]; [self addSubview:_titleL]; [_titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.bottom.equalTo(self); make.left.equalTo(self).offset(16); make.width.mas_equalTo(0); }]; _titleL.adjustsFontSizeToFitWidth=YES; _titleL.textColor=HDLEZ_COLOR_TEXT_TITLE_GRAY; _titleL.font=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14); //右箭头 _nextImgV=[[UIImageView alloc] init]; [self addSubview:_nextImgV]; [_nextImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self).offset(-20); make.centerY.equalTo(self.mas_centerY); make.width.height.mas_equalTo(16); }]; _nextImgV.image=[UIImage imageNamed:@"hdl_ez_list_next"]; //内容lable _contentL=[[UILabel alloc] init]; [self addSubview:_contentL]; [_contentL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.bottom.equalTo(self); make.left.equalTo(_titleL.mas_right).offset(5); make.right.equalTo(_nextImgV.mas_left).offset(-5); }]; _contentL.adjustsFontSizeToFitWidth=YES; _contentL.numberOfLines=2; _contentL.textAlignment=NSTextAlignmentRight; _contentL.textColor=HDLEZ_COLOR_TEXT_INPUT_PLACEHOLD_GRAY; _contentL.font=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12); //下划线 _lineV=[[UIView alloc] init]; [self addSubview:_lineV]; [_lineV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(16); make.bottom.equalTo(self); make.right.equalTo(self).offset(-16); make.height.mas_equalTo(1); }]; _lineV.backgroundColor=HDLEZ_COLOR_BACKGROUND_LINE; //按钮 _button=[[UIButton alloc] init]; [self addSubview:_button]; [_button mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); }]; [_button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside]; } /*点击按钮 */ -(void)buttonClick{ if (self.clickBtn) { self.clickBtn(); } } /*隐藏右侧箭头 */ -(void)hideNextImg{ [_nextImgV mas_updateConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(0); }]; [_nextImgV setHidden:YES]; } -(void)setTitle:(NSString *)title{ _title=title; CGSize titleSize=[title sizeWithAttributes:@{NSFontAttributeName:HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14)}]; [_titleL mas_updateConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(titleSize.width+5); }]; _titleL.text=title; } @end