|
//
// TopicCreatAskCellTableViewCell.m
// ThePaperBase
//
// Created by zhousan on 15/8/24.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "TopicCreatAskCellTableViewCell.h"
#import "SDWebImageManager.h"
@implementation TopicCreatAskCellTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backBtn.hidden = YES;
self.replyButton.userInteractionEnabled = NO;
self.replyButton.hidden = NO;
[self.replyButton setTitleEdgeInsets:UIEdgeInsetsMake(6, 0, 4, 0)];
}return self;
}
- (void)setSortIndex:(NSString *)sortIndex {
if ([sortIndex isEqualToString:@"0"]) {
self.anserNumsLabel.hidden = YES;
self.commentImg.hidden = YES;
self.lineView.hidden = YES;
self.replyButton.hidden = NO;
}else {
self.replyButton.hidden = YES;
self.anserNumsLabel.hidden = NO;
self.commentImg.hidden = NO;
self.lineView.hidden = NO;
}
}
- (void)setIsAnswer:(BOOL)isAnswer {
self.replyButton.selected = isAnswer;
}
- (void)awakeFromNib {
// Initialization code
}
- (void)reLayoutSubViews {
CGFloat width = returnTextWidthWithRTLabel(self.anserNumsLabel.text, 10, appFont(8, NO), 0)+5;
__weak typeof(self) weakSelf = self;
[self.anserNumsLabel remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(weakSelf.backView.right).offset(-15);
make.bottom.equalTo(weakSelf.timeImg.bottom).offset(-1);
make.height.mas_equalTo(9);
make.width.mas_equalTo(width);
}];
[self.askContentLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.backView.left).offset(10);
make.top.equalTo(self.answerIcon.bottom).offset(10);
make.height.mas_equalTo(self.cellHeight);
make.right.equalTo(self.backView.right).offset(-10);
}];
}
- (void)subLayoutSubViews {
[super subLayoutSubViews];
[self.replyButton makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.askAuthorLabel.top).offset(5);
make.right.equalTo(self.backView.right).offset(-10);
make.height.mas_equalTo(20);
make.width.mas_equalTo(40);
}];
}
- (void)replyButtonBtnClick:(UIButton *)btn {
if ([self.delegate respondsToSelector:@selector(replyButtonClick:WithCell:)]) {
[self.delegate replyButtonClick:btn WithCell:self];
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
|