123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- //
- // KXLoanButton.m
- // QBCS
- //
- // Created by kuxuan on 2017/6/5.
- // Copyright © 2017年 kuxuan. All rights reserved.
- //
- #import "KXLoanButton.h"
- @implementation KXLoanButton
- {
- UIImageView *_picView;
- UILabel *_titleLabel;
- UILabel *_descLabel;
-
- }
- -(instancetype)initWithFrame:(CGRect)frame
- {
- if (self==[super initWithFrame:frame]) {
- self.backgroundColor=[UIColor whiteColor];
- [self setupUI];
- }
- return self;
- }
- -(void)setupUI
- {
- _picView=[[UIImageView alloc]init];
- [self addSubview:_picView];
-
- _titleLabel=[[UILabel alloc]init];
- _titleLabel.font=[UIFont systemFontOfSize:14*SCREEN_MUTI];
- _titleLabel.textColor=[UIColor KXColorWithHex:0x333333];
- _titleLabel.textAlignment = NSTextAlignmentLeft;
- [self addSubview:_titleLabel];
-
- _descLabel = [[UILabel alloc] init];
- _descLabel.font = FONT_SYS(12);
- _descLabel.textColor = [UIColor detailTitleColor];
- _descLabel.textAlignment = NSTextAlignmentLeft;
- [self addSubview:_descLabel];
-
- self.redButton = [UIButton buttonWithType:UIButtonTypeCustom];
- [self.redButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- self.redButton.titleLabel.font = FONT_SYS(6*SCREEN_MUTI);
- self.redButton.titleEdgeInsets = UIEdgeInsetsMake(-4*SCREEN_MUTI, 0, 0, 0);
- [self.redButton setBackgroundImage:[UIImage imageNamed:@"main_new"] forState:UIControlStateNormal];
- [self addSubview:self.redButton];
-
- [_picView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.mas_left).offset(Fitsize(9));
- make.size.equalTo(CGSizeMake(Fitsize(41), Fitsize(41)));
- make.centerY.equalTo(self.mas_centerY);
- }];
- [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(_picView.mas_right).offset(Fitsize(10));
- make.top.equalTo(_picView.mas_top);
- }];
- [_descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(_titleLabel.mas_left);
- make.bottom.equalTo(_picView.mas_bottom);
- }];
- [self.redButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(_titleLabel.mas_top);
- make.left.equalTo(_titleLabel.mas_right).offset(Fitsize(6));
- make.size.equalTo(CGSizeMake(Fitsize(14), Fitsize(11)));
- }];
- }
- -(void)setName:(NSString *)name
- {
- _name=name;
- _titleLabel.text=name;
-
- }
- -(void)setButtonImage:(UIImage *)buttonImage
- {
- _buttonImage=buttonImage;
- _picView.image=buttonImage;
- }
- - (void)setDescName:(NSString *)descName{
- _descName = descName;
- _descLabel.text = descName;
- }
- @end
|