【发布时间】:2021-04-29 17:48:09
【问题描述】:
我是 IOS 编程的新手。我参与了一个现有的项目,我面临一个问题。 UIRefreshControl 正在阻止下面的视图。像附加的图像(UIRefreshControl 是透明的黑色)。
UIRefreshControl 正在阻止其下方的视图。但是当我做一些小滚动时,UIRefreshControl 消失了,然后下面的按钮就可以点击了。
这里是一些sn-p的代码。 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
}()
被阻止的视图在 CommentHeaderView.swift 中声明。
编辑 我试过了
refresh.layer.zPosition = -100
但仍然无法正常工作。
有人可以帮助我吗?提前致谢!
【问题讨论】: