I am new in IoS programming. I am involved in an existing project, and I am facing a problem. UIRefreshControl is blocking views below. Like image attached (UIRefreshControl is transparent black).
UIRefreshControl is blocking views below it. But when I am doing some little scroll, the UIRefreshControl is disappeared, and then the button below is clickable.
Here is some snippet of the code. CommentView.swift
lazy var collectionView: UICollectionView = {
layout.scrollDirection = .vertical
let collectionView: UICollectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.isUserInteractionEnabled = true
collectionView.backgroundColor = .white
collectionView.refreshControl = refreshControl
collectionView.registerCustomCell(CommentCell.self)
collectionView.register(CommentHeaderView.self, forSupplementaryViewOfKind: CommentView.className, withReuseIdentifier: CommentHeaderView.className)
return collectionView
}()
lazy var refreshControl: UIRefreshControl = {
let refresh = UIRefreshControl()
refresh.tintColor = .primary
refresh.addTarget(self, action: #selector(handleRefresh), for: .valueChanged)
refresh.backgroundColor = UIColor.blackTransparent
return refresh
}()
The blocked views are declared inside CommentHeaderView.swift.
EDIT I have tried
refresh.layer.zPosition = -100
but still not working.
Anyone can help me? Thanks in advance!