// // HSQSectionAllGoodView.m // YouHuiProject // // Created by liuxueli on 2018/12/14. // Copyright © 2018 kuxuan. All rights reserved. // #import "HSQSectionAllGoodView.h" @implementation HSQSectionAllGoodView -(instancetype)initWithFrame:(CGRect)frame { self =[super initWithFrame:frame]; if (self) { self.backgroundColor =[UIColor backgroudColor]; UIView *views =[[UIView alloc]init]; views.backgroundColor =[UIColor whiteColor]; UIImageView *leftimg =[[UIImageView alloc]init]; leftimg.image =[UIImage imageNamed:@"search_left"]; UILabel *label =[[UILabel alloc]init]; label.text=@"全网商品"; label.textColor=[UIColor colorWithRGB:0x3B3B3B]; [label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:FITSIZE(16)]]; UIImageView *rightimg =[[UIImageView alloc]init]; rightimg.image =[UIImage imageNamed:@"search_right"]; UIImageView *lineV =[[UIImageView alloc]init]; lineV.backgroundColor =[UIColor backgroudColor]; [self addSubview:views]; [self addSubview:leftimg]; [self addSubview:label]; [self addSubview:rightimg]; [self addSubview:lineV]; [views mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(FITSIZE(10)); make.width.mas_equalTo(self.mas_width); make.height.mas_equalTo(self.mas_height).offset(-FITSIZE(10)); }]; [label mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(views.mas_centerX); make.centerY.mas_equalTo(views.mas_centerY); make.width.mas_equalTo(FITSIZE(70)); }]; [leftimg mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(label.mas_left).offset(FITSIZE(-10)); make.width.mas_equalTo(FITSIZE(13)); make.height.mas_equalTo(FITSIZE(7)); make.centerY.mas_equalTo(views.mas_centerY); }]; [rightimg mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(label.mas_right).offset(FITSIZE(15)); make.width.mas_equalTo(FITSIZE(13)); make.height.mas_equalTo(FITSIZE(7)); make.centerY.mas_equalTo(views.mas_centerY); }]; [lineV mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(views.mas_width); make.height.mas_equalTo(1); make.top.mas_equalTo(views.mas_bottom).offset(-1); }]; } return self; } @end