热更新demo

HotAskCell.m 3.8KB

    // // HotAskCell.m // ThePaperBase // // Created by zhousan on 15/8/27. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "HotAskCell.h" @implementation HotAskCell - (void)subLayoutSubViews { [self.backView makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left).offset(10); make.top.equalTo(self.top); make.bottom.equalTo(self.bottom); make.right.equalTo(self.right).offset(-10); }]; [self.backBtn makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.backView); }]; [self.answerIcon makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.backView.left).offset(10); make.top.equalTo(self.backView.top).offset(7); make.width.mas_equalTo(28); make.height.mas_equalTo(28); }]; [self.iconBack makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.answerIcon); }]; [self.UserInfoBtn makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.answerIcon); }]; self.replyButton.hidden = YES; [self.verifyTag makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.backView.left).offset(28); make.top.equalTo(self.backView.top).offset(28); make.height.mas_equalTo(12); make.width.mas_equalTo(12); }]; [self.askAuthorLabel makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.backView.left).offset(47); make.top.equalTo(self.backView.top).offset(5); make.height.mas_equalTo(14); make.width.mas_equalTo(200); }]; // [self.anserNumsLabel makeConstraints:^(MASConstraintMaker *make) { // make.left.equalTo(self.commentImg.right).offset(1); // make.top.equalTo(self.backView.top).offset(25); // make.height.mas_equalTo(9); // make.width.mas_equalTo(17); // }]; [self.commentImg makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.anserNumsLabel.left); make.top.equalTo(self.backView.top).offset(23); make.height.mas_equalTo(12); make.width.mas_equalTo(12); }]; [self.timeImg makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.backView.left).offset(48); make.top.equalTo(self.backView.top).offset(25); make.height.mas_equalTo(10); make.width.mas_equalTo(10); }]; [self.timeLabel makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.timeImg.right).offset(5); make.top.equalTo(self.askAuthorLabel.bottom).offset(7); make.height.mas_equalTo(9); make.width.mas_equalTo(rect_screen.size.width/2); }]; [self.lineView makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.backView.left); make.top.equalTo(self.askContentLabel.bottom).offset(14); make.width.equalTo(self.backView.width); make.height.mas_equalTo(0.5); }]; } - (void)reLayoutSubViews { CGFloat width = returnTextWidthWithRTLabel(self.anserNumsLabel.text, 10, appFont(8, NO), 0)+2; __weak typeof(self) weakSelf = self; [self.anserNumsLabel remakeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(weakSelf.backView.right).offset(-15); make.top.equalTo(weakSelf.backView.top).offset(25); 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); }]; } @end