Files
keyboard/Pods/JXCategoryView/Sources/VerticalZoomTitle/JXCategoryTitleVerticalZoomCell.m

46 lines
2.0 KiB
Mathematica
Raw Normal View History

2025-11-06 19:19:12 +08:00
//
// JXCategoryTitleVerticalZoomCell.m
// JXCategoryView
//
// Created by jiaxin on 2019/2/14.
// Copyright © 2019 jiaxin. All rights reserved.
//
#import "JXCategoryTitleVerticalZoomCell.h"
#import "JXCategoryTitleVerticalZoomCellModel.h"
@implementation JXCategoryTitleVerticalZoomCell
- (void)reloadData:(JXCategoryBaseCellModel *)cellModel {
[super reloadData:cellModel];
JXCategoryTitleVerticalZoomCellModel *myCellModel = (JXCategoryTitleVerticalZoomCellModel *)cellModel;
if (myCellModel.isTitleLabelZoomEnabled) {
//fonttitleLabelZoomScaletransform
UIFont *maxScaleFont = [UIFont fontWithDescriptor:myCellModel.titleFont.fontDescriptor size:myCellModel.titleFont.pointSize*myCellModel.maxVerticalFontScale];
CGFloat baseScale = myCellModel.titleFont.lineHeight/maxScaleFont.lineHeight;
if (myCellModel.isSelectedAnimationEnabled && [self checkCanStartSelectedAnimation:myCellModel]) {
JXCategoryCellSelectedAnimationBlock block = [self preferredTitleZoomAnimationBlock:myCellModel baseScale:baseScale];
[self addSelectedAnimationBlock:block];
} else {
self.titleLabel.font = maxScaleFont;
self.maskTitleLabel.font = maxScaleFont;
CGAffineTransform currentTransform = CGAffineTransformMakeScale(baseScale*myCellModel.titleLabelCurrentZoomScale, baseScale*myCellModel.titleLabelCurrentZoomScale);
self.titleLabel.transform = currentTransform;
self.maskTitleLabel.transform = currentTransform;
}
} else {
if (myCellModel.isSelected) {
self.titleLabel.font = myCellModel.titleSelectedFont;
self.maskTitleLabel.font = myCellModel.titleSelectedFont;
}else {
self.titleLabel.font = myCellModel.titleFont;
self.maskTitleLabel.font = myCellModel.titleFont;
}
}
[self.titleLabel sizeToFit];
}
@end