123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // 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
|