// // KXUpDownButton.m // CAISHEN // // Created by kuxuan on 2017/8/28. // Copyright © 2017年 kuxuan. All rights reserved. // #import "KXUpDownButton.h" @implementation KXUpDownButton - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundColor = [UIColor whiteColor]; [self setupUI]; } return self; } - (void)setupUI { self.titleLabel = [[UILabel alloc]init]; self.titleLabel.text = @"查看更多"; self.titleLabel.textColor = [UIColor titleColor]; self.titleLabel.font = FONT_SYS(14); self.titleLabel.textAlignment = NSTextAlignmentRight; [self addSubview:self.titleLabel]; self.imageView = [[UIImageView alloc]init]; self.imageView.image = [UIImage imageNamed:@"main_detail_down"]; [self addSubview:self.imageView]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.mas_top).offset(15); make.centerX.equalTo(self.mas_centerX); }]; [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel.mas_right).offset(1); make.centerY.equalTo(self.titleLabel.mas_centerY); make.size.equalTo(CGSizeMake(10, 6)); }]; } @end