You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.9 KiB
101 lines
3.9 KiB
4 years ago
|
//
|
||
|
// TFComicBrowseBottomCell.m
|
||
|
// TFReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/15.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFComicBrowseBottomCell.h"
|
||
|
#import "TFComicBrowseBottomBar.h"
|
||
|
|
||
|
@interface TFComicBrowseBottomCell ()
|
||
|
{
|
||
|
TFButton *previousButton;
|
||
|
TFButton *nextButton;
|
||
|
}
|
||
|
@end
|
||
|
|
||
|
@implementation TFComicBrowseBottomCell
|
||
|
|
||
|
- (void)createSubviews
|
||
|
{
|
||
|
[super createSubviews];
|
||
|
|
||
|
previousButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"上一篇") buttonImageName:@"public_back" buttonIndicator:TFButtonIndicatorTitleRight];
|
||
|
previousButton.tag = 0;
|
||
|
previousButton.buttonImageScale = 0.2;
|
||
|
[previousButton addTarget:self action:@selector(changeChapter:) forControlEvents:UIControlEventTouchUpInside];
|
||
|
[self.contentView addSubview:previousButton];
|
||
|
|
||
|
[previousButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kMargin);
|
||
|
make.top.mas_equalTo(self.contentView.mas_top);
|
||
|
make.width.mas_equalTo(self.contentView.mas_width).multipliedBy(0.5).with.offset(- kMargin);
|
||
|
make.height.mas_equalTo(60);
|
||
|
make.bottom.mas_equalTo(self.contentView.mas_bottom).with.offset(- (PUB_TABBAR_HEIGHT + Comic_Menu_Bottom_Bar_Top_Height)).priorityLow();
|
||
|
}];
|
||
|
|
||
|
UIView *line = [[UIView alloc] init];
|
||
|
line.backgroundColor = kGrayLineColor;
|
||
|
[self.contentView addSubview:line];
|
||
|
|
||
|
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.mas_equalTo(previousButton.mas_right);
|
||
|
make.height.mas_equalTo(previousButton.mas_height).with.multipliedBy(0.8);
|
||
|
make.width.mas_equalTo(kCellLineHeight);
|
||
|
make.centerY.mas_equalTo(previousButton.mas_centerY);
|
||
|
}];
|
||
|
|
||
|
nextButton = [[TFButton alloc] initWithFrame:CGRectZero buttonTitle:TFLocalizedString(@"下一篇") buttonImageName:@"public_back" buttonIndicator:TFButtonIndicatorTitleLeft];
|
||
|
nextButton.transformImageView = YES;
|
||
|
nextButton.tag = 1;
|
||
|
nextButton.buttonImageScale = 0.2;
|
||
|
[nextButton addTarget:self action:@selector(changeChapter:) forControlEvents:UIControlEventTouchUpInside];
|
||
|
[self.contentView addSubview:nextButton];
|
||
|
|
||
|
[nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kMargin);
|
||
|
make.top.mas_equalTo(self.contentView.mas_top);
|
||
|
make.width.mas_equalTo(previousButton.mas_width);
|
||
|
make.height.mas_equalTo(previousButton.mas_height);
|
||
|
}];
|
||
|
|
||
|
}
|
||
|
|
||
|
- (void)setComicChapterModel:(TFProductionChapterModel *)comicChapterModel
|
||
|
{
|
||
|
_comicChapterModel = comicChapterModel;
|
||
|
|
||
|
if (comicChapterModel.last_chapter > 0) {
|
||
|
previousButton.buttonTintColor = kBlackColor;
|
||
|
} else {
|
||
|
previousButton.buttonTintColor = kGrayTextLightColor;
|
||
|
}
|
||
|
|
||
|
if (comicChapterModel.next_chapter > 0) {
|
||
|
nextButton.buttonTintColor = kBlackColor;
|
||
|
} else {
|
||
|
nextButton.buttonTintColor = kGrayTextLightColor;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- (void)changeChapter:(UIButton *)sender
|
||
|
{
|
||
|
if (sender.tag == 0) { // 上一篇
|
||
|
if (self.comicChapterModel.last_chapter > 0) {
|
||
|
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Switch_Chapter object:[TFUtilsHelper formatStringWithInteger:self.comicChapterModel.last_chapter]];
|
||
|
} else {
|
||
|
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"已是第一篇")];
|
||
|
}
|
||
|
} else { // 下一篇
|
||
|
if (self.comicChapterModel.next_chapter > 0) {
|
||
|
[[NSNotificationCenter defaultCenter] postNotificationName:Notification_Switch_Chapter object:[TFUtilsHelper formatStringWithInteger:self.comicChapterModel.next_chapter]];
|
||
|
} else {
|
||
|
[TFPromptManager showPromptViewWithStatus:TFPromptStatusError promptTitle:TFLocalizedString(@"已是最后一篇")];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@end
|