2
This commit is contained in:
@@ -70,12 +70,15 @@ static NSString * const kKBSvipBenefitBgKind = @"KBSvipBenefitBgDecoration"; //
|
||||
UIEdgeInsets sectionInset0 = [self insetForSection:0];
|
||||
UIEdgeInsets sectionInset1 = [self insetForSection:1];
|
||||
|
||||
// 1. 外层大背景(18圆角):从 Section 0 顶部到 Section 1 底部
|
||||
// 固定的外层背景边距(不跟随 Section inset)
|
||||
CGFloat outerPadding = 16;
|
||||
|
||||
// 1. 外层大背景(18圆角):固定距离屏幕左右 16
|
||||
{
|
||||
CGFloat minY = CGRectGetMinY(firstItemAttr.frame) - sectionInset0.top;
|
||||
CGFloat maxY = CGRectGetMaxY(lastBenefitAttr.frame) + 16;
|
||||
CGFloat x = sectionInset0.left;
|
||||
CGFloat width = self.collectionView.bounds.size.width - sectionInset0.left - sectionInset0.right;
|
||||
CGFloat x = outerPadding;
|
||||
CGFloat width = self.collectionView.bounds.size.width - outerPadding * 2;
|
||||
|
||||
CGRect frame = CGRectMake(x, minY, width, maxY - minY);
|
||||
|
||||
@@ -87,10 +90,11 @@ static NSString * const kKBSvipBenefitBgKind = @"KBSvipBenefitBgDecoration"; //
|
||||
|
||||
// 2. 内层权益背景(15圆角):从 Section 1 Header 到 Section 1 底部,左右距离外层 8px
|
||||
{
|
||||
CGFloat innerPadding = 8; // 距离外层背景的边距
|
||||
CGFloat minY = CGRectGetMinY(benefitHeaderAttr.frame);
|
||||
CGFloat maxY = CGRectGetMaxY(lastBenefitAttr.frame) + 16;
|
||||
CGFloat x = sectionInset0.left + 8; // 距离外层左边 8px
|
||||
CGFloat width = self.collectionView.bounds.size.width - sectionInset0.left - sectionInset0.right - 16; // 左右各 8px
|
||||
CGFloat x = outerPadding + innerPadding;
|
||||
CGFloat width = self.collectionView.bounds.size.width - (outerPadding + innerPadding) * 2;
|
||||
|
||||
CGRect frame = CGRectMake(x, minY, width, maxY - minY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user