From 6f804ab200970e6a445b8c23cc085e68e1a383ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=88=E6=88=90?= <694220741@qq.com> Date: Mon, 9 Jan 2023 17:33:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PCComicPictureController.m | 7 +- Pica/Category/Model/PCUser.m | 9 +- Pica/Category/View/PCComicInfoView.m | 102 ++++++++++++------ 3 files changed, 77 insertions(+), 41 deletions(-) diff --git a/Pica/Category/Controller/PCComicPictureController.m b/Pica/Category/Controller/PCComicPictureController.m index 5c6f00a..83b4599 100644 --- a/Pica/Category/Controller/PCComicPictureController.m +++ b/Pica/Category/Controller/PCComicPictureController.m @@ -77,9 +77,10 @@ - (void)setupToolbarItems { [super setupToolbarItems]; UIBarButtonItem *flexibleItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL]; - - UIBarButtonItem *item1 = [QMUIToolbarButton barButtonItemWithType:QMUIToolbarButtonTypeNormal title:@"上一话" target:self action:@selector(lastEpisode:)]; - UIBarButtonItem *item2 = [QMUIToolbarButton barButtonItemWithType:QMUIToolbarButtonTypeNormal title:@"下一话" target:self action:@selector(nextEpisode:)]; + UIBarButtonItem *item1 = [QMUIToolbarButton barButtonItemWithImage:[UIImage systemImageNamed:@"arrow.left"] target:self action:@selector(lastEpisode:)]; + UIBarButtonItem *item2 = [QMUIToolbarButton barButtonItemWithImage:[UIImage systemImageNamed:@"arrow.right"] target:self action:@selector(nextEpisode:)]; + item1.tintColor = UIColorBlack; + item2.tintColor = UIColorBlack; self.toolbarItems = @[item1, flexibleItem, item2]; } diff --git a/Pica/Category/Model/PCUser.m b/Pica/Category/Model/PCUser.m index 0b2c235..a8c7755 100644 --- a/Pica/Category/Model/PCUser.m +++ b/Pica/Category/Model/PCUser.m @@ -28,13 +28,8 @@ + (NSArray *)characterImageArray { //https://www.picacomic.com or https://pica-pica.wikawika.xyz if (!PCCharacterImageArray) { PCCharacterImageArray = [[NSMutableArray alloc] init]; - [PCCharacterImageArray addObjectsFromArray:@[ @"https://pica-pica.wikawika.xyz/characters/frame_knight_9.png", @"https://pica-pica.wikawika.xyz/characters/frame_knight_100_249.png", @"https://pica-pica.wikawika.xyz/characters/frame_knight_1000.png", @"https://pica-pica.wikawika.xyz/characters/frame_knight_500_999.png", @"https://pica-pica.wikawika.xyz/characters/verified.png", @"https://pica-pica.wikawika.xyz/images/monster.jpg", @"https://pica-pica.wikawika.xyz/images/halloween_bot.png", @"https://pica-pica.wikawika.xyz/images/halloween_f.png", @"https://pica-pica.wikawika.xyz/images/halloween_m.png", - @"https://pica-pica.wikawika.xyz/special/frame-dirty.png"]]; - for (NSInteger i = 1; i < 10; i++) { - [PCCharacterImageArray addObject:[NSString stringWithFormat:@"https://pica-pica.wikawika.xyz/special/hat-%@.png", @(i)]]; - } - for (NSInteger i = 1; i < 491; i++) { - [PCCharacterImageArray addObject:[NSString stringWithFormat:@"https://pica-pica.wikawika.xyz/special/frame-%@.png", @(i)]]; + for (NSInteger i = 1; i < 636; i++) { + [PCCharacterImageArray addObject:[NSString stringWithFormat:@"https://bidobido.xyz/special/frame-%@.png", @(i)]]; } } return [PCCharacterImageArray copy]; diff --git a/Pica/Category/View/PCComicInfoView.m b/Pica/Category/View/PCComicInfoView.m index 40622d2..894b716 100644 --- a/Pica/Category/View/PCComicInfoView.m +++ b/Pica/Category/View/PCComicInfoView.m @@ -18,12 +18,12 @@ #import "PCUserInfoView.h" #import "PCCommonUI.h" -@interface PCComicInfoView () +@interface PCComicInfoView () @property (nonatomic, strong) UIImageView *coverView; @property (nonatomic, strong) QMUILabel *titleLabel; -@property (nonatomic, strong) QMUIButton *authorButton; -@property (nonatomic, strong) QMUIButton *sinicizationButton; +@property (nonatomic, strong) QMUILabel *authorLabel; +@property (nonatomic, strong) QMUILabel *sinicizationLabel; @property (nonatomic, strong) QMUILabel *viewLabel; @property (nonatomic, strong) QMUILabel *categoryLabel; @property (nonatomic, strong) QMUILabel *descLabel; @@ -35,6 +35,8 @@ @interface PCComicInfoView () @property (nonatomic, strong) QMUILabel *nameLabel; @property (nonatomic, strong) QMUILabel *timeLabel; +@property (nonatomic, strong) QMUIImagePreviewViewController *previewViewController; + @end @implementation PCComicInfoView @@ -56,8 +58,8 @@ - (instancetype)initWithFrame:(CGRect)frame { - (void)didInitialize { [self addSubview:self.coverView]; [self addSubview:self.titleLabel]; - [self addSubview:self.authorButton]; - [self addSubview:self.sinicizationButton]; + [self addSubview:self.authorLabel]; + [self addSubview:self.sinicizationLabel]; [self addSubview:self.viewLabel]; [self addSubview:self.categoryLabel]; [self addSubview:self.descLabel]; @@ -79,11 +81,11 @@ - (void)layoutSubviews { self.coverView.frame = CGRectMake(15, 10, 90, 130); self.titleLabel.frame = CGRectMake(115, 10, self.qmui_width - 120, QMUIViewSelfSizingHeight); - [self.authorButton sizeToFit]; - self.authorButton.frame = CGRectSetXY(self.authorButton.frame, 115, self.titleLabel.qmui_bottom + 5); - [self.sinicizationButton sizeToFit]; - self.sinicizationButton.frame = CGRectSetXY(self.sinicizationButton.frame, 115, self. authorButton.qmui_bottom + 5); - self.viewLabel.frame = CGRectMake(115, self.sinicizationButton.qmui_bottom + 5, self.qmui_width - 120, QMUIViewSelfSizingHeight); + [self.authorLabel sizeToFit]; + self.authorLabel.frame = CGRectSetXY(self.authorLabel.frame, 115, self.titleLabel.qmui_bottom + 5); + [self.sinicizationLabel sizeToFit]; + self.sinicizationLabel.frame = CGRectSetXY(self.sinicizationLabel.frame, 115, self. authorLabel.qmui_bottom + 5); + self.viewLabel.frame = CGRectMake(115, self.sinicizationLabel.qmui_bottom + 5, self.qmui_width - 120, QMUIViewSelfSizingHeight); self.categoryLabel.frame = CGRectMake(115, self.viewLabel.qmui_bottom + 5, self.qmui_width - 120, QMUIViewSelfSizingHeight); self.tagView.frame = CGRectMake(15, self.coverView.qmui_bottom + 10, self.qmui_width - 30, QMUIViewSelfSizingHeight); self.descLabel.frame = CGRectMake(15, self.comic.tags.count ? self.tagView.qmui_bottom + 10 : self.tagView.qmui_bottom, self.qmui_width - 30, QMUIViewSelfSizingHeight); @@ -132,20 +134,20 @@ - (void)tagAction:(QMUIButton *)sender { [[QMUIHelper visibleViewController].navigationController pushViewController:list animated:YES]; } -- (void)authorAction:(QMUIButton *)sender { +- (void)authorAction:(UITapGestureRecognizer *)sender { PCComicListController *list = [[PCComicListController alloc] initWithType:PCComicListTypeAuthor]; - list.keyword = sender.currentTitle; + list.keyword = self.authorLabel.text; [[QMUIHelper visibleViewController].navigationController pushViewController:list animated:YES]; } -- (void)sinicizationAction:(QMUIButton *)sender { +- (void)sinicizationAction:(UITapGestureRecognizer *)sender { PCComicListController *list = [[PCComicListController alloc] initWithType:PCComicListTypeTranslate]; - list.keyword = sender.currentTitle; + list.keyword = self.sinicizationLabel.text; [[QMUIHelper visibleViewController].navigationController pushViewController:list animated:YES]; } - (void)avatarAction:(UIGestureRecognizer *)sender { - if (self.comic.chineseTeam.length && ![self.comic.chineseTeam isEqualToString:@"无"] && [self.comic.chineseTeam isEqualToString:@"不明"]) { + if (self.comic.chineseTeam.length && ![self.comic.chineseTeam isEqualToString:@"无"] && ![self.comic.chineseTeam isEqualToString:@"不明"]) { QMUIModalPresentationViewController *controller = [[QMUIModalPresentationViewController alloc] init]; PCUserInfoView *infoView = [[PCUserInfoView alloc] init]; infoView.user = self.comic.creator; @@ -154,6 +156,19 @@ - (void)avatarAction:(UIGestureRecognizer *)sender { } } +- (void)coverAction:(UIGestureRecognizer *)sender { + if (!self.previewViewController) { + self.previewViewController = [[QMUIImagePreviewViewController alloc] init]; + self.previewViewController.presentingStyle = QMUIImagePreviewViewControllerTransitioningStyleZoom; + self.previewViewController.imagePreviewView.delegate = self; + } + self.previewViewController.sourceImageView = ^UIView *{ + return sender.view; + }; + + [[QMUIHelper visibleViewController] presentViewController:self.previewViewController animated:YES completion:nil]; +} + - (void)commentAction { PCCommentController *comment = [[PCCommentController alloc] initWithComicId:self.comic.comicId]; comment.commentType = PCCommentTypeComic; @@ -180,6 +195,30 @@ - (void)favouriteAction { }]; } +#pragma mark - QMUIImagePreviewViewDelegate +- (NSUInteger)numberOfImagesInImagePreviewView:(QMUIImagePreviewView *)imagePreviewView { + return 1; +} + +- (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView renderZoomImageView:(QMUIZoomImageView *)zoomImageView atIndex:(NSUInteger)index { + [[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:self.comic.thumb.imageURL] + options:kNilOptions + progress:nil + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (image) { + zoomImageView.image = image; + } + }]; +} + +- (QMUIImagePreviewMediaType)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView assetTypeAtIndex:(NSUInteger)index { + return QMUIImagePreviewMediaTypeImage; +} + +- (void)singleTouchInZoomingImageView:(QMUIZoomImageView *)zoomImageView location:(CGPoint)location { + [self.previewViewController dismissViewControllerAnimated:YES completion:nil]; +} + #pragma mark - Get - (UIImageView *)coverView { if (!_coverView) { @@ -188,6 +227,8 @@ - (UIImageView *)coverView { _coverView.clipsToBounds = YES; _coverView.layer.cornerRadius = 4; _coverView.layer.masksToBounds = YES; + _coverView.userInteractionEnabled = YES; + [_coverView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(coverAction:)]]; } return _coverView; } @@ -196,28 +237,27 @@ - (QMUILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [[QMUILabel alloc] init]; _titleLabel.numberOfLines = 2; + _titleLabel.canPerformCopyAction = YES; } return _titleLabel; } -- (QMUIButton *)authorButton { - if (!_authorButton) { - _authorButton = [[QMUIButton alloc] init]; - _authorButton.titleLabel.font = UIFontMake(13); - [_authorButton setTitleColor:PCColorHotPink forState:UIControlStateNormal]; - [_authorButton addTarget:self action:@selector(authorAction:) forControlEvents:UIControlEventTouchUpInside]; +- (QMUILabel *)authorLabel { + if (!_authorLabel) { + _authorLabel = [[QMUILabel alloc] qmui_initWithFont:UIFontMake(13) textColor:PCColorHotPink]; + _authorLabel.canPerformCopyAction = YES; + [_authorLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(authorAction:)]]; } - return _authorButton; + return _authorLabel; } -- (QMUIButton *)sinicizationButton { - if (!_sinicizationButton) { - _sinicizationButton = [[QMUIButton alloc] init]; - _sinicizationButton.titleLabel.font = UIFontMake(13); - [_sinicizationButton setTitleColor:UIColorGrayLighten forState:UIControlStateNormal]; - [_sinicizationButton addTarget:self action:@selector(sinicizationAction:) forControlEvents:UIControlEventTouchUpInside]; +- (QMUILabel *)sinicizationLabel { + if (!_sinicizationLabel) { + _sinicizationLabel = [[QMUILabel alloc] qmui_initWithFont:UIFontMake(13) textColor:UIColorGrayLighten]; + _sinicizationLabel.canPerformCopyAction = YES; + [_sinicizationLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sinicizationAction:)]]; } - return _sinicizationButton; + return _sinicizationLabel; } - (QMUILabel *)categoryLabel { @@ -320,8 +360,8 @@ - (void)setComic:(PCComic *)comic { [self.coverView pc_setImageWithURL:comic.thumb.imageURL]; self.titleLabel.text = comic.title; - [self.authorButton setTitle:comic.author forState:UIControlStateNormal]; - [self.sinicizationButton setTitle:comic.chineseTeam forState:UIControlStateNormal]; + self.authorLabel.text = comic.author; + self.sinicizationLabel.text = comic.chineseTeam; self.viewLabel.text = [NSString stringWithFormat:@"绅士指名次数:%@ %@", @(comic.viewsCount), comic.finished ? @"(已完结)" : @""]; NSMutableString *category = [NSMutableString stringWithString:@"分类 "]; [comic.categories enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { From 2a17ddc083a0d0b7d5ef49f7af15143dc805dfa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=88=E6=88=90?= <694220741@qq.com> Date: Mon, 9 Jan 2023 17:35:28 +0800 Subject: [PATCH 2/2] v1.3.4 --- Pica.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pica.xcodeproj/project.pbxproj b/Pica.xcodeproj/project.pbxproj index baa0a50..82a5173 100644 --- a/Pica.xcodeproj/project.pbxproj +++ b/Pica.xcodeproj/project.pbxproj @@ -1515,7 +1515,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 1.3.3; + MARKETING_VERSION = 1.3.4; PRODUCT_BUNDLE_IDENTIFIER = com.yuecheng.pica; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1541,7 +1541,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 1.3.3; + MARKETING_VERSION = 1.3.4; PRODUCT_BUNDLE_IDENTIFIER = com.yuecheng.pica; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2";