小说绘上架版本
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// TFFeedBackHeaderView.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackHeaderView : UIView
|
||||
|
||||
@property (nonatomic, copy) void(^leftButtonClick)(void);
|
||||
@property (nonatomic, copy) void(^rightButtonClick)(void);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// TFFeedBackHeaderView.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackHeaderView.h"
|
||||
|
||||
@implementation TFFeedBackHeaderView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self createSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
TFButton *leftButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"首页我的反馈") buttonSubTitle:@"" buttonImageName:@"feedback_talk" buttonIndicator:TFButtonIndicatorTitleRight showMaskView:NO];
|
||||
leftButton.graphicDistance = 1;
|
||||
leftButton.buttonImageScale = 0.4;
|
||||
leftButton.buttonTitleFont = kBoldFont15;
|
||||
leftButton.tag = 1;
|
||||
[leftButton addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:leftButton];
|
||||
|
||||
[leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_left);
|
||||
make.top.mas_equalTo(self.mas_top);
|
||||
make.height.mas_equalTo(self.mas_height);
|
||||
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
||||
}];
|
||||
|
||||
UIView *line = [[UIView alloc] init];
|
||||
line.backgroundColor = kGrayViewColor;
|
||||
[self addSubview:line];
|
||||
|
||||
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(leftButton.mas_right);
|
||||
make.centerY.mas_equalTo(leftButton.mas_centerY);
|
||||
make.width.mas_equalTo(2);
|
||||
make.height.mas_equalTo(self.mas_height).with.multipliedBy(0.5);
|
||||
}];
|
||||
|
||||
TFButton *rightButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"反馈意见") buttonSubTitle:@"" buttonImageName:@"feedback_list" buttonIndicator:TFButtonIndicatorTitleRight showMaskView:NO];
|
||||
rightButton.graphicDistance = 1;
|
||||
rightButton.buttonImageScale = 0.4;
|
||||
rightButton.buttonTitleFont = kBoldFont15;
|
||||
rightButton.tag = 2;
|
||||
[rightButton addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:rightButton];
|
||||
|
||||
[rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.mas_right);
|
||||
make.top.mas_equalTo(self.mas_top);
|
||||
make.height.mas_equalTo(self.mas_height);
|
||||
make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)menuClick:(UIButton *)sender
|
||||
{
|
||||
if (!TFUserInfoManager.isLogin) {
|
||||
[TFLoginOptionsViewController presentLoginView:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender.tag == 1) {
|
||||
if (self.leftButtonClick) {
|
||||
self.leftButtonClick();
|
||||
}
|
||||
} else if (sender.tag == 2) {
|
||||
if (self.rightButtonClick) {
|
||||
self.rightButtonClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// TFFeedBackRecordViewCell.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TFFeedBackRecordModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackRecordViewCell : TFBasicTableViewCell
|
||||
|
||||
@property (nonatomic ,strong) TFFeedbackContentModel *contentModel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// TFFeedBackRecordViewCell.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/23.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackRecordViewCell.h"
|
||||
#import "TFPhotoBrowser.h"
|
||||
|
||||
@interface TFFeedBackRecordViewCell ()
|
||||
{
|
||||
UILabel *dateLabel;
|
||||
UILabel *questionLabel;
|
||||
UIView *questionImageBack;
|
||||
UILabel *replyLabel;
|
||||
|
||||
NSArray *questionImageArray;
|
||||
|
||||
UIView *line;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TFFeedBackRecordViewCell
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
dateLabel = [[UILabel alloc] init];
|
||||
dateLabel.textColor = kGrayTextColor;
|
||||
dateLabel.textAlignment = NSTextAlignmentLeft;
|
||||
dateLabel.font = kFont11;
|
||||
[self.contentView addSubview:dateLabel];
|
||||
|
||||
[dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top).with.offset(kHalfMargin);
|
||||
make.width.mas_equalTo(self.contentView.mas_width).with.offset(- kMargin);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
questionLabel = [[UILabel alloc] init];
|
||||
questionLabel.textColor = kBlackColor;
|
||||
questionLabel.textAlignment = NSTextAlignmentLeft;
|
||||
questionLabel.font = kMainFont;
|
||||
questionLabel.numberOfLines = 0;
|
||||
[self.contentView addSubview:questionLabel];
|
||||
[questionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(dateLabel.mas_left);
|
||||
make.width.mas_equalTo(dateLabel.mas_width);
|
||||
make.top.mas_equalTo(dateLabel.mas_bottom);
|
||||
}];
|
||||
|
||||
questionImageBack = [[UIView alloc] init];
|
||||
questionImageBack.backgroundColor = kWhiteColor;
|
||||
[self.contentView addSubview:questionImageBack];
|
||||
|
||||
[questionImageBack mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(dateLabel.mas_left);
|
||||
make.top.mas_equalTo(questionLabel.mas_bottom).with.offset(kHalfMargin);
|
||||
make.right.mas_equalTo(dateLabel.mas_right);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
|
||||
line = [[UIView alloc] init];
|
||||
line.backgroundColor = kGrayLineColor;
|
||||
line.hidden = YES;
|
||||
[self.contentView addSubview:line];
|
||||
|
||||
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(kMargin);
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(kHalfMargin);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH - kMargin);
|
||||
make.height.mas_equalTo(kCellLineHeight);
|
||||
}];
|
||||
|
||||
replyLabel = [[UILabel alloc] init];
|
||||
replyLabel.textColor = kGrayTextColor;
|
||||
replyLabel.textAlignment = NSTextAlignmentLeft;
|
||||
replyLabel.font = kMainFont;
|
||||
replyLabel.numberOfLines = 10;
|
||||
[self.contentView addSubview:replyLabel];
|
||||
|
||||
[replyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(dateLabel.mas_left);
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(kMargin);
|
||||
make.right.mas_equalTo(dateLabel.mas_right);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).with.offset(- kHalfMargin).priorityLow();
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setContentModel:(TFFeedbackContentModel *)contentModel
|
||||
{
|
||||
_contentModel = contentModel;
|
||||
|
||||
dateLabel.text = contentModel.created_at?:@"";
|
||||
|
||||
questionLabel.text = [TFLocalizedString(@"问题:\n\n") stringByAppendingString:contentModel.content?:@""];
|
||||
|
||||
if (questionImageArray.count != contentModel.images.count) {
|
||||
NSInteger buttonNum = contentModel.images.count;//每行多少按钮
|
||||
CGFloat button_W = 60;//按钮宽
|
||||
CGFloat button_H = 60;//按钮高
|
||||
CGFloat space_X = 10;//按钮间距
|
||||
for (NSInteger i = 0; i < buttonNum; i++) {
|
||||
NSInteger loc = i % buttonNum;//列号
|
||||
|
||||
CGFloat button_X = (space_X + button_W) * loc;
|
||||
CGFloat button_Y = 0;
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.frame = CGRectMake(button_X, button_Y, button_W, button_H);
|
||||
button.tag = i;
|
||||
button.adjustsImageWhenHighlighted = NO;
|
||||
[button setImageWithURL:[NSURL URLWithString:[contentModel.images objectOrNilAtIndex:i]] forState:UIControlStateNormal options:YYWebImageOptionSetImageWithFadeAnimation];
|
||||
[button addTarget:self action:@selector(watchPhoto:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[questionImageBack addSubview:button];
|
||||
}
|
||||
[questionImageBack mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(70);
|
||||
}];
|
||||
}
|
||||
|
||||
if (contentModel.reply.length > 0) {
|
||||
line.hidden = NO;
|
||||
replyLabel.text = [TFLocalizedString(@"回复:\n\n") stringByAppendingString:contentModel.reply?:@""];
|
||||
[replyLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(kMargin);
|
||||
make.height.mas_equalTo([TFViewHelper getDynamicHeightWithLabelFont:replyLabel.font labelWidth:(SCREEN_WIDTH - kMargin) labelText:replyLabel.text] - kHalfMargin);
|
||||
}];
|
||||
} else {
|
||||
line.hidden = YES;
|
||||
[replyLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(questionImageBack.mas_bottom).with.offset(CGFLOAT_MIN);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)watchPhoto:(UIButton *)sender
|
||||
{
|
||||
TFPhotoBrowser *browser = [TFPhotoBrowser new];
|
||||
browser.dataSource = self.contentModel.images.mutableCopy;
|
||||
browser.downLoadNeeded = YES;
|
||||
browser.currentPhotoIndex = sender.tag;
|
||||
[[TFViewHelper getCurrentViewController] presentViewController:browser animated:YES completion:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// TFFeedBackViewCellCell.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TFFeedBackModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TFFeedBackViewCellCell : TFBasicTableViewCell
|
||||
|
||||
@property (nonatomic ,strong) TFQuestionListModel *questionModel;
|
||||
@property (nonatomic ,assign) BOOL detailCellShowing;
|
||||
|
||||
- (void)showDetail;
|
||||
|
||||
- (void)hiddenDetail;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// TFFeedBackViewCellCell.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/22.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFFeedBackViewCellCell.h"
|
||||
|
||||
@interface TFFeedBackViewCellCell ()
|
||||
{
|
||||
UILabel *questionTitleLabel;
|
||||
UILabel *questionDetailLabel;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation TFFeedBackViewCellCell
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
[super createSubviews];
|
||||
|
||||
questionTitleLabel = [[UILabel alloc] init];
|
||||
questionTitleLabel.backgroundColor = kWhiteColor;
|
||||
questionTitleLabel.textColor = kBlackColor;
|
||||
questionTitleLabel.font = kMainFont;
|
||||
questionTitleLabel.numberOfLines = 0;
|
||||
questionTitleLabel.userInteractionEnabled = YES;
|
||||
[self.contentView addSubview:questionTitleLabel];
|
||||
|
||||
[questionTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(self.contentView.mas_top);
|
||||
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kHalfMargin);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
questionDetailLabel = [[UILabel alloc] init];
|
||||
questionDetailLabel.textColor = kGrayTextColor;
|
||||
questionDetailLabel.font = kMainFont;
|
||||
questionDetailLabel.numberOfLines = 0;
|
||||
[self.contentView addSubview:questionDetailLabel];
|
||||
|
||||
[questionDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(questionTitleLabel.mas_left).with.offset(kHalfMargin);
|
||||
make.top.mas_equalTo(questionTitleLabel.mas_bottom);
|
||||
make.right.mas_equalTo(questionTitleLabel.mas_right).with.offset(- kHalfMargin);
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).priorityLow();
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setQuestionModel:(TFQuestionListModel *)questionModel
|
||||
{
|
||||
_questionModel = questionModel;
|
||||
|
||||
questionTitleLabel.text = [NSString stringWithFormat:@"Q:%@", questionModel.title]?:@"";
|
||||
[questionTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo([TFViewHelper getDynamicHeightWithLabelFont:kMainFont labelWidth:(SCREEN_WIDTH - kMargin) labelText:questionTitleLabel.text]);
|
||||
}];
|
||||
|
||||
questionDetailLabel.text = [NSString stringWithFormat:@"A:%@", questionModel.answer]?:@"";
|
||||
}
|
||||
|
||||
- (void)showDetail
|
||||
{
|
||||
self.detailCellShowing = YES;
|
||||
|
||||
[UIView animateWithDuration:kAnimatedDurationFast animations:^{
|
||||
[self->questionDetailLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo([TFViewHelper getDynamicHeightWithLabel:self->questionDetailLabel] - kHalfMargin);
|
||||
}];
|
||||
[self->questionDetailLabel.superview layoutIfNeeded];//强制绘制
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)hiddenDetail
|
||||
{
|
||||
self.detailCellShowing = NO;
|
||||
|
||||
[UIView animateWithDuration:kAnimatedDurationFast animations:^{
|
||||
[self->questionDetailLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(CGFLOAT_MIN);
|
||||
}];
|
||||
[self->questionDetailLabel.superview layoutIfNeeded];//强制绘制
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user