// // DetailNoCommentCell.m // FirstLink // // Created by jack on 15/9/9. // Copyright (c) 2015年 FirstLink. All rights reserved. // #import "DetailNoCommentCell.h" @interface DetailNoCommentCell () @property (nonatomic, strong) UIImageView *imgView; @property (nonatomic, strong) UILabel *titleLabel; @end @implementation DetailNoCommentCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self addAllSubviews]; self.selectionStyle = UITableViewCellSelectionStyleNone; } return self; } - (void)addAllSubviews{ [self.contentView addSubview:self.imgView]; [self.contentView addSubview:self.titleLabel]; [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(33); make.centerX.equalTo(self.contentView); }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.imgView.mas_bottom).offset(15); make.centerX.equalTo(self.contentView); }]; } - (UIImageView *)imgView{ if (_imgView == nil) { _imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sofa"]]; } return _imgView; } - (UILabel *)titleLabel{ if (_titleLabel == nil) { _titleLabel = [[UILabel alloc]init]; _titleLabel.font = [UIFont systemFontOfSize:14]; _titleLabel.textColor = UIColorFromRGB(0x999999); _titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.text = @"还没有评论,抢个沙发吧~"; } return _titleLabel; } @end