From 28f1c70ccd4d2caf8723dcc315bf639004a65d30 Mon Sep 17 00:00:00 2001 From: LeeJay Date: Fri, 2 Jun 2017 12:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Linkage/CollectionView/CollectionViewController.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Linkage/CollectionView/CollectionViewController.swift b/Linkage/CollectionView/CollectionViewController.swift index a21557c..aebfb9d 100644 --- a/Linkage/CollectionView/CollectionViewController.swift +++ b/Linkage/CollectionView/CollectionViewController.swift @@ -131,14 +131,11 @@ extension CollectionViewController { fileprivate func frameForHeader(section: Int) -> CGRect { let indexPath = IndexPath(item: 0, section: section) - let attributes = collectionView.layoutAttributesForSupplementaryElement(ofKind: UICollectionElementKindSectionHeader, at: indexPath) - + let attributes = collectionView.collectionViewLayout.layoutAttributesForSupplementaryView(ofKind: UICollectionElementKindSectionHeader, at: indexPath) guard let frameForFirstCell = attributes?.frame else { return .zero } - - let headerHeight = collectionView(collectionView, layout: flowlayout, referenceSizeForHeaderInSection: section).height - return frameForFirstCell.offsetBy(dx: 0, dy: -headerHeight); + return frameForFirstCell; } }