// // KXEventTopView.m // CAISHEN // // Created by jikaipeng on 2017/8/24. // Copyright © 2017年 kuxuan. All rights reserved. // #import "KXEventTopView.h" @interface KXEventTopView () @end @implementation KXEventTopView - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self addSubview:self.imageview]; [self addSubview:self.titleLabel]; [self addSubview:self.detaileLabel]; [self addConstraint]; } return self; } - (void)addConstraint{ [self.imageview mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.mas_left).offset(16*SCREEN_MUTI); make.size.equalTo(CGSizeMake(50*SCREEN_MUTI, 42*SCREEN_MUTI)); make.centerY.equalTo(self.mas_centerY); }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.imageview.mas_top); make.left.equalTo(self.imageview.mas_right).offset(16); }]; [self.detaileLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.titleLabel.mas_left); make.bottom.equalTo(self.imageview.mas_bottom); }]; } - (UIImageView *)imageview{ if (!_imageview) { _imageview = [[UIImageView alloc] init]; } return _imageview; } - (UILabel *)titleLabel{ if (!_titleLabel) { _titleLabel = [[UILabel alloc]init]; _titleLabel.font = FONT_SYS(16); _titleLabel.textColor = [UIColor titleColor]; } return _titleLabel; } - (UILabel *)detaileLabel{ if (!_detaileLabel) { _detaileLabel = [[UILabel alloc] init]; _detaileLabel.font = FONT_SYS(12); _detaileLabel.textColor = [UIColor KXColorWithHex:0x666666]; } return _detaileLabel; } @end