123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- //
- // KWHisCollectHeaderView.m
- // westkissMob
- //
- // Created by iOS on 2022/9/14.
- //
- #import "KWHisCollectHeaderView.h"
- @interface KWHisCollectHeaderView ()
- @end
- @implementation KWHisCollectHeaderView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self configSubV];
- }
- return self;
- }
- - (void)configSubV {
- self.backgroundColor = [UIColor colorWithHexString:@"#f8f8f8"];
-
-
- [self addSubview:self.titleLb];
- [self addSubview:self.imgV];
- [self addSubview:self.btn];
-
- [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(13);
- make.left.equalTo(self).offset(20);
- make.bottom.equalTo(self).offset(-7);
- make.height.equalTo(@20);
- }];
- [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.titleLb.mas_right).offset(10);
- make.bottom.equalTo(self).offset(-10);
- make.right.equalTo(self).offset(-20);
- make.width.equalTo(@24);
- make.height.equalTo(@24);
- }];
-
- [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.imgV);
- }];
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (UILabel *)titleLb {
- if (!_titleLb) {
- UILabel *lb = [[UILabel alloc] init];
- lb.font = [UIFont fontWithName:Rob_Bold size:14];
- lb.textColor = [UIColor colorWithHexString:@"#0b0b0b"];
- lb.textAlignment = NSTextAlignmentLeft;
- lb.backgroundColor = [UIColor clearColor];
- lb.numberOfLines = 1;
- _titleLb = lb;
- }
- return _titleLb;
- }
- -(UIImageView *)imgV {
- if (!_imgV) {
- UIImageView *img = [[UIImageView alloc] init];
- img.contentMode = UIViewContentModeScaleAspectFit;
- img.image = [UIImage imageNamed:@"search_his_clean"];
- _imgV = img;
- }
- return _imgV;
- }
- -(UIButton *)btn {
- if (!_btn) {
- UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
- [bt addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside];
- bt.backgroundColor = UIColor.clearColor;
- [bt setTitle:@"" forState:UIControlStateNormal];
- _btn = bt;
- }
- return _btn;
- }
- - (void)clickAction {
- if (self.callBack) {
- self.callBack();
- }
- }
- @end
|