OGeek|极客世界-中国程序员成长平台

标题: ios - 淡出 UIRefreshControl 或将其从透明 ScrollView 中隐藏 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:37
标题: ios - 淡出 UIRefreshControl 或将其从透明 ScrollView 中隐藏

我想以比平常更快的速度从透明 ScrollView 中隐藏我的 UIRefreshControl 并快速淡出,这样它就不会与文本重叠。任何类似的解决方案将不胜感激!

let refreshControl = UIRefreshControl()

refreshControl.tintColor = UIColor.white
let color = [NSAttributedStringKey.foregroundColor: UIColor.white]
refreshControl.attributedTitle = NSAttributedString(string: "ull to refresh", attributes: color)
refreshControl.addTarget(self, action: #selector(refreshData), for: .valueChanged)
scrollView.refreshControl = refreshControl

@objc func refreshData(refreshControl: UIRefreshControl) {

    updateBitcoinValueLabel()
    updateBitcoinCashValueLabel()
    updateEthereumValueLabel()
    updateLitecoinValueLabel()
    updateRippleValueLabel()
    updateWalletValueLabel()

    refreshControl.endRefreshing()
}

+ Example

你们有什么想法吗?



Best Answer-推荐答案


你可以试试这个

override func scrollViewWillEndDragging(_ scrollView: UIScrollView, 
                       withVelocity velocity: CGPoint, 
                targetContentOffset: UnsafeMutablePointer<CGPoint>)
 {
     self.refreshControl.isHidden = true

 }

关于ios - 淡出 UIRefreshControl 或将其从透明 ScrollView 中隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48308943/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4