|
//
// askFootCell.m
// ThePaperDemo
//
// Created by scar1900 on 14-9-28.
// Copyright (c) 2014年 scar1900. All rights reserved.
//
#import "askFootCell.h"
@interface askFootCell()
@property(nonatomic, strong)UIView *backView;
@property(nonatomic, strong)UIView *lineView;
@property(nonatomic, strong)UIView *footView;
@end
@implementation askFootCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
[self addSubview:self.backView];
[self.backView addSubview:self.lineView];
[self addSubview:self.footView];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
return self;
}
- (void)needrefreshNightMode:(id)sender{
self.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
_footView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
_lineView.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
_backView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (UIView*)backView {
if (!_backView) {
_backView = [[UIView alloc]initWithFrame:CGRectZero];
_backView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
}
return _backView;
}
- (UIView*)lineView {
if (!_lineView) {
_lineView = [[UIView alloc]initWithFrame:CGRectZero];
_lineView.backgroundColor = [UIColor colorWithHexString:LINECOLOR];
}
return _lineView;
}
- (UIView*)footView {
if (!_footView) {
_footView = [[UIView alloc]initWithFrame:CGRectZero];
_footView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
}
return _footView;
}
- (void)layoutSubviews {
self.backView.frame =CGRectMake(10, 0, CGRectGetWidth(self.bounds)-20, 10);
self.lineView.frame =CGRectMake(0, CGRectGetHeight(self.backView.bounds)-1, CGRectGetWidth(self.backView.bounds), 1);
self.footView.frame = CGRectMake(0, CGRectGetMaxY(self.backView.frame), CGRectGetWidth(self.bounds), 10);
[super layoutSubviews];
}
@end
|