|
//
// DetailAckIconCell.m
// ThePaperBase
//
// Created by zhousan on 15/11/20.
// Copyright © 2015年 scar1900. All rights reserved.
//
#import "DetailAckIconCell.h"
@implementation DetailAckIconCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.commentImg.hidden = YES;
self.anserNumsLabel.hidden = YES;
self.attentionBtn.hidden = NO;
// self.backBtn.hidden = YES;
}
return self;
}
- (void)attentionBtnClick:(UIButton *)sender {
[MobClick event:@"56"];
if ([self.delegate respondsToSelector:@selector(attentionBtnClick:withcell:)]) {
[self.delegate attentionBtnClick:sender withcell:self];
}
}
- (void)reLayoutSubViews {
CGFloat width = returnTextWidthWithRTLabel(self.anserNumsLabel.text, 10, appFont(8, NO), 0)+5;
CGFloat nameWidth = returnTextWidthWithRTLabel(self.askAuthorLabel.text, 10, appFont(11, NO), 0)+5;
__weak typeof(self) weakSelf = self;
if (nameWidth > rect_screen.size.width - 145) {
nameWidth = rect_screen.size.width - 145;
}
[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.askAuthorLabel remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.backView.left).offset(47);
make.top.equalTo(weakSelf.backView.top).offset(10);
make.height.mas_equalTo(14);
make.width.mas_equalTo(nameWidth);
}];
}
- (void)subLayoutSubViews {
[super subLayoutSubViews];
[self.attentionBtn 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);
}];
[self.topicNumsLabel makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.attentionBtn.left).offset(-5);
make.top.equalTo(self.attentionBtn.top).offset(3);
make.height.mas_equalTo(12);
make.width.mas_equalTo(70);
}];
}
@end
|