3
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user