scrollToItem at indexPath at .top hides cell under header when sectionHeadersPinToVisibleBounds
问题 Using the following configuration: let layout = UICollectionViewFlowLayout() layout.sectionHeadersPinToVisibleBounds = true let collectionViewController = UICollectionViewController(view.bounds, collectionViewLayout: layout) The following code will scroll to the given index path but the item will be under and covered by its header: let indexPath = IndexPath(section: 0, row: 2) collecitonView.scrollToItem(at: indexPath, at: .top, animated: true) How do I get the collection view to scroll to