// // AnnoContentTableViewCell.m // redstar // // Created by admin on 15/11/30. // Copyright © 2015年 ZWF. All rights reserved. // #import "AnnoContentTableViewCell.h" @implementation AnnoContentTableViewCell - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc] init]; _titleLabel.textColor = kNavigationBarColor; _titleLabel.font = [UIFont systemFontOfSize:13.0]; _titleLabel.translatesAutoresizingMaskIntoConstraints = NO; [self.contentView addSubview:_titleLabel]; NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; [self.contentView addConstraint:contentTop]; NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20]; [self.contentView addConstraint:contentLeft]; NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; [self.contentView addConstraint:contentRight]; NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20]; [self.contentView addConstraint:contentHeight]; } return _titleLabel; } - (UILabel *)contentLabel { if (!_contentLabel) { _contentLabel = [[UILabel alloc] init]; _contentLabel.textColor = kLightBlack; _contentLabel.font = [UIFont systemFontOfSize:13.0]; _contentLabel.numberOfLines = 0; _contentLabel.translatesAutoresizingMaskIntoConstraints = NO; [self.contentView addSubview:_contentLabel]; NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:2]; [self.contentView addConstraint:contentTop]; NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20]; [self.contentView addConstraint:contentLeft]; NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; [self.contentView addConstraint:contentRight]; NSLayoutConstraint *contentBottom = [NSLayoutConstraint constraintWithItem:_contentLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10]; [self.contentView addConstraint:contentBottom]; } return _contentLabel; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end