When scrolling through my UICollectionView
it's showing more than one scroll indicator. I've noticed there is a one for every section in the collection. See screenshot displaying three at the same time:
Anyone experienced same issue? I am using Xcode 9 beta 3. My collectionview setup is quite common:
private let formCollectionView: UICollectionView = {
let collectionViewLayout = UICollectionViewFlowLayout()
collectionViewLayout.minimumLineSpacing = 0
collectionViewLayout.minimumInteritemSpacing = 0
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewLayout)
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.backgroundColor = UIColor.clear
return collectionView
}()
Edit 10/16/2017
Even Twitter seems having this issue:
you can fix this problem in delegate method.as in the following example
Objective-C
- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath
{
if (@available(iOS 11.0, *)) {
if ([elementKind isEqualToString:UICollectionElementKindSectionHeader]) {
view.layer.zPosition = 0;
}
}
}
Swift
func collectionView(_ collectionView: UICollectionView, willDisplaySupplementaryView view: UICollectionReusableView, forElementKind elementKind: String, at indexPath: IndexPath) {
if elementKind == UICollectionView.elementKindSectionHeader {
view.layer.zPosition = 0
}
}
Ok, so first of all there is a radar already.
There is a proposed workaround. I was partially successful with doing this crap inside my UICollectionReusableView
subclass.
override func apply(_ layoutAttributes: UICollectionViewLayoutAttributes) {
super.apply(layoutAttributes)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.01) {
self.layer.zPosition = 0
}
}
I am saying partially because if you have a little bit longer UICollectionView
it's still corrupted for some headers. Most of them are ok though. So it depends on your situation. Hopefully that radar will be addressed soon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With