|
//
// hotAskCardCell.m
// ThePaperBase
//
// Created by scar1900 on 15/7/30.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "hotAskCardCell.h"
@interface hotAskCardCell()
@end
@implementation hotAskCardCell
@synthesize listBO = _listBO;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.contentView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.cardImageView];
[self.cardImageView makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.left).offset(10);
make.right.equalTo(self.contentView.right).offset(-10);
make.top.equalTo(self.contentView.top).offset(10);
make.bottom.equalTo(self.contentView.bottom);
}];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
return self;
}
- (void)setListBO:(listContObjectVO *)data {
_listBO = data;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *imageID = getImageNameFromURL(data.pic);
dispatch_async(dispatch_get_main_queue(), ^{
self.cardImageView.imageUrl = data.pic;
self.cardImageView.imageId = imageID;
});
});
}
- (AsyncImageView*)cardImageView {
if (!_cardImageView) {
_cardImageView = [AsyncImageView new];
_cardImageView.backgroundColor = [UIColor clearColor];
}
return _cardImageView;
}
- (void)needrefreshNightMode:(id)sender{
self.contentView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
|