私は単一のビュープロジェクトを作成し、collectionViewを追加しました。私は自己iOS11 UICollectionSectionHeaderクリッピングスクロールインジケータ
extension ViewController: UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 100
}
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: kHeader, for: indexPath)
return headerView
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
cell.backgroundColor = UIColor.blue
return cell
}
}
extension ViewController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return CGSize(width: collectionView.bounds.width, height: 88)
}
}
にUICollectionReusableView
final class TestReusableView: UICollectionReusableView {
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor.red
}
...
}
設定データソースとデリゲートの単純なサブクラスを登録結果は、セクションヘッダが垂直スクロール・インジケータの上方に位置するように見えるです。しかし、私が10.3.1シミュレータに対してアプリを実行すると、動作は期待どおりに機能します。
私もセクションヘッダは、すべてのビューの上に配置されているiOSの11.0と同様の問題に遭遇しました。すべて10.3でうまく動作します。 – Aks
iOS 11.0+の問題のようです。私はそれにも走っています。私が見つけることができる最も近いRADARは、次のとおりです。http://www.openradar.me/34308893 – isoiphone