// // FKSexChoseView.m // FirstLink // // Created by jack on 16/4/26. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKSexChoseBtn.h" @interface FKSexChoseBtn () @property (nonatomic, strong) UIImageView *arrowImgView; @end @implementation FKSexChoseBtn - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self addAllSubviews]; } return self; } - (instancetype)initWithSexTitle:(NSString *)title{ if (self = [super init]) { self.titleLabel.text = title; } return self; } - (void)addAllSubviews{ self.backgroundColor = [UIColorFromRGB(0xff6362) colorWithAlphaComponent:0.5]; [self addSubview:self.arrowImgView]; [self addSubview:self.titleLabel]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self); make.left.equalTo(self).offset(15); }]; [self.arrowImgView mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self).offset(- 15); make.centerY.equalTo(self); }]; } - (UILabel *)titleLabel{ if (_titleLabel == nil) { _titleLabel = [[UILabel alloc]init]; _titleLabel.textColor = UIColorFromRGB(0xffffff); _titleLabel.font = [UIFont systemFontOfSize:17]; } return _titleLabel; } - (UIImageView *)arrowImgView{ if (_arrowImgView == nil) { _arrowImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"guideRightArrow"]]; } return _arrowImgView; } @end