澎湃iPad上线版本

messageTopCell.m 1.8KB

    // // messageTopCell.m // ThePaperHD // // Created by liyuan on 15/7/21. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "messageTopCell.h" @interface messageTopCell(){ CGFloat titleHieght; } @property(nonatomic, strong)UILabel *titleLabel; @end @implementation messageTopCell @synthesize topTitle = _topTitle; - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if(self){ self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; [self.contentView addSubview:self.titleLabel]; } return self; } -(void)setTopTitle:(NSString *)str{ _topTitle = str; self.titleLabel.text = _topTitle; titleHieght = heightForString(self.titleLabel.text, self.titleLabel.font, messagePopSize.width-30, NSLineBreakByWordWrapping); [self layoutSub]; } -(UILabel *)titleLabel{ if (!_titleLabel) { _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _titleLabel.font = appFont(13, NO); _titleLabel.numberOfLines = 0; _titleLabel.lineBreakMode = NSLineBreakByWordWrapping; _titleLabel.textColor = [UIColor colorWithHexString:TextBlack]; _titleLabel.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR]; } return _titleLabel; } -(void)layoutSub{ self.titleLabel.frame = CGRectMake(15, 15, messagePopSize.width-30, titleHieght+8); } @end