// // addressCell.m // b // // Created by kaidan on 2017/1/12. // Copyright © 2017年 kaidan. All rights reserved. // #import "messageHearderCell.h" #import "Masonry.h" @interface messageHearderCell () @end @implementation messageHearderCell -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self addSubViews]; } return self; } -(UIImageView *)iconImg{ if (!_iconImg) { _iconImg = [[UIImageView alloc] init]; } return _iconImg; } -(UILabel *)titleLab{ if (!_titleLab) { _titleLab = [[UILabel alloc] init]; } return _titleLab; } -(UILabel *)phonoeLab{ if (!_phonoeLab) { _phonoeLab = [[UILabel alloc] init]; } return _phonoeLab; } - (void)layoutSubviews { [super layoutSubviews]; [self layoutIfNeeded]; self.iconImg.layer.masksToBounds = YES; self.iconImg.layer.cornerRadius = 60/2.0; } -(void)addSubViews{ UILabel* lab = [[UILabel alloc] init]; lab.text = @"号码:"; self.titleLab.textAlignment = NSTextAlignmentLeft; self.phonoeLab.textAlignment = NSTextAlignmentLeft; [self addSubview:self.iconImg]; [self addSubview:self.titleLab]; [self addSubview:lab]; [self addSubview:self.phonoeLab]; [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.equalTo(@(60)); make.left.equalTo(@(10)); make.centerY.equalTo(self); }]; [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.iconImg.mas_top).offset(6); make.left.equalTo(self.iconImg.mas_right).offset(10); make.width.equalTo(@180); make.height.equalTo(@20); }]; [lab mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.titleLab.mas_bottom).offset(7); make.left.height.equalTo(self.titleLab); // make.width.equalTo(@65); }]; [self.phonoeLab mas_makeConstraints:^(MASConstraintMaker *make) { make.height.top.equalTo(lab); make.left.equalTo(lab.mas_right).offset(5); make.width.equalTo(@150); }]; // self.titleLab.font = DefineFontSize; // self.phonoeLab.font = DefineFontSize; // lab.font = DefineFontSize; self.titleLab.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:16]; self.phonoeLab.font = [UIFont systemFontOfSize:12]; self.phonoeLab.textColor = RGB(155, 155, 155); lab.font = [UIFont systemFontOfSize:12]; lab.textColor = RGB(155, 155, 155); } @end