This commit is contained in:
2025-11-17 15:39:03 +08:00
parent dc813fcabc
commit d849b201ca
7 changed files with 59 additions and 19 deletions

View File

@@ -22,10 +22,11 @@
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self.contentView);
//
make.height.equalTo(self.contentView.mas_width).multipliedBy(0.58);
// make.height.equalTo(self.contentView.mas_width).multipliedBy(0.58);
make.height.mas_equalTo(KBFit(264));
}];
[self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(12);
make.left.equalTo(self.contentView).offset(0);
make.top.equalTo(self.coverView.mas_bottom).offset(10);
}];
[self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {

View File

@@ -13,11 +13,11 @@
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
self.contentView.layer.cornerRadius = 16;
self.contentView.layer.cornerRadius = 12;
self.contentView.layer.masksToBounds = YES;
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(6, 12, 6, 12));
make.edges.equalTo(self.contentView);
}];
}
return self;
@@ -28,10 +28,10 @@
}
+ (CGSize)sizeForText:(NSString *)text {
if (text.length == 0) { return CGSizeMake(40, 32); }
if (text.length == 0) { return CGSizeMake(40, 24); }
CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}];
// 12 + 12 32
return CGSizeMake(ceil(s.width) + 24, 32);
return CGSizeMake(ceil(s.width) + 24, 24);
}
#pragma mark - Lazy
@@ -39,8 +39,9 @@
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:14];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
_titleLabel.font = [UIFont systemFontOfSize:12];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
}
return _titleLabel;
}

View File

@@ -13,7 +13,7 @@
self.contentView.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16);
make.left.equalTo(self.contentView).offset(0);
make.centerY.equalTo(self.contentView);
}];
}

View File

@@ -77,7 +77,7 @@ static NSString * const kInnerTagCellId = @"kInnerTagCellId";
UICollectionViewLeftAlignedLayout *layout = [UICollectionViewLeftAlignedLayout new];
layout.minimumInteritemSpacing = 8;
layout.minimumLineSpacing = 8;
layout.sectionInset = UIEdgeInsetsMake(8, 0, 8, 16);
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
_tagsView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_tagsView.backgroundColor = [UIColor whiteColor];

View File

@@ -122,12 +122,12 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
switch (indexPath.section) {
case KBSkinDetailSectionHeader: {
// = 0.58W + 56
CGFloat h = contentW * 0.58 + 56;
CGFloat h = KBFit(264) + 30;
return CGSizeMake(contentW, h);
}
case KBSkinDetailSectionTags: {
CGFloat h = [KBSkinTagsContainerCell heightForTags:self.tags width:W];
return CGSizeMake(contentW, h);
return CGSizeMake(contentW, 25);
}
case KBSkinDetailSectionTitle: {
return CGSizeMake(contentW, 44);
@@ -144,7 +144,17 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(12, 16, 12, 16);
// Header Tags
switch (section) {
case KBSkinDetailSectionHeader:
// 12
return UIEdgeInsetsMake(12, 16, 4, 16);
case KBSkinDetailSectionTags:
// Header
return UIEdgeInsetsMake(14, 16, 5, 16);
default:
return UIEdgeInsetsMake(0, 16, 12, 16);
}
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {