具有大标题和收藏夹视图的UIRefresh Control UI错误

时间:2018-06-25 10:04:10

标签: swift uirefreshcontrol

我正在使用嵌入在UITabBarController和UINavigationController中的UICollectionViewController,并且当我在选项卡之间多次切换时,偶尔会遇到一个错误,即我不希望刷新控件出现在标题上方。

Refresh Control UI Bug

Debug View Hierachy

var refreshControl: UIRefreshControl = {
    let refreshControl = UIRefreshControl()
    refreshControl.tintColor = UIColor.primaryRed
    return refreshControl
}()

refreshControl.addTarget(self, action: #selector(refreshData), for: .valueChanged)
collectionView?.refreshControl = refreshControl

@objc private func refreshData() {
    refreshControl.beginRefreshing()
    datasource.fetchEvents {
        self.refreshControl.endRefreshing()
        self.collectionView?.reloadData()
    }
}

0 个答案:

没有答案