|
//
// userInfoBaseCell.m
// ThePaperDemo
//
// Created by scar1900 on 14/12/11.
// Copyright (c) 2014年 scar1900. All rights reserved.
//
#import "userInfoBaseCell.h"
@interface userInfoBaseCell()
@property(nonatomic, strong)UIView *lineView;
@property(nonatomic, strong)UIView *selectView;
@end
@implementation userInfoBaseCell
@synthesize title = _title;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.contentView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
self.selectedBackgroundView = self.selectView;
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.pushIcon];
[self.contentView addSubview:self.lineView];
}
return self;
}
- (UIView *)selectView {
if (!_selectView) {
_selectView = [[UIView alloc]initWithFrame:CGRectZero];
_selectView.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
}
return _selectView;
}
- (void)setTitle:(NSString *)titleStr {
_title = titleStr;
self.titleLabel.text = titleStr;
}
- (UILabel*)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc]initWithFrame:CGRectZero];
_titleLabel.textAlignment = NSTextAlignmentLeft;
_titleLabel.textColor = [UIColor colorWithHexString:TextBlack];
_titleLabel.backgroundColor = [UIColor clearColor];
}
_titleLabel.font = appFont(18, NO);
return _titleLabel;
}
- (UIImageView*)pushIcon {
if (!_pushIcon) {
_pushIcon = [[UIImageView alloc]initWithFrame:CGRectZero];
_pushIcon.image = Image(@"login/pushIcon.png");
}
return _pushIcon;
}
- (UIView*)lineView {
if (!_lineView) {
_lineView = [[UIView alloc]initWithFrame:CGRectZero];
_lineView.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
}
return _lineView;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.titleLabel.frame = CGRectMake(15, 0, CGRectGetWidth(self.bounds)-15, CGRectGetHeight(self.bounds));
self.pushIcon.frame = CGRectMake(CGRectGetWidth(self.bounds)-20,CGRectGetHeight(self.bounds)/2-8 , 10, 16);
self.lineView.frame = CGRectMake(15, CGRectGetHeight(self.bounds)-1, CGRectGetWidth(self.bounds)-15, 0.5);
[self.contentView bringSubviewToFront:self.lineView];
}
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
|