|
//
// authorAndTimeCell.m
// ThePaperDemo
//
// Created by Scar on 14-9-18.
// Copyright (c) 2014年 scar1900. All rights reserved.
//
#import "authorAndTimeCell.h"
@interface authorAndTimeCell()
@property(nonatomic, strong)UILabel *cellTextLabel;
@end
@implementation authorAndTimeCell
@synthesize text = _text;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.cellTextLabel];
}
return self;
}
- (void)setText:(NSString *)str {
_text = str;
self.cellTextLabel.text =str;
[self layoutSubviews];
}
- (UILabel*)cellTextLabel {
if (!_cellTextLabel) {
_cellTextLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_cellTextLabel.backgroundColor = [UIColor clearColor];
_cellTextLabel.textAlignment = NSTextAlignmentLeft;
_cellTextLabel.textColor = [UIColor colorWithHexString:TextGray];
_cellTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
}
_cellTextLabel.font = appFont(15, NO);
return _cellTextLabel;
}
- (void)layoutSubviews {
CGFloat padding = 0;
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
padding = 125;
}
self.cellTextLabel.frame = CGRectMake(padding, 0, 1320/2, 15);
[super layoutSubviews];
}
- (void)awakeFromNib
{
// Initialization code
}
@end
|