[英]Add progress view to UITableViewCell
我想在表格視圖單元格中顯示文件的上傳進度。 我正在以編程方式使用進度視圖。 但是,進度視圖與文件名及其相關數據重疊。 如何使進度視圖顯示在文本后面?
以下是使用的代碼:
let animationProgress = UIProgressView(progressViewStyle: .bar)
var prog: Float = 0.0
animationProgress.progress += 0.5
animationProgress.rightAnchor.accessibilityActivate()
animationProgress.tintColor = .dbbSearchBarBackgroundColor()
animationProgress.setProgress(prog, animated: true)
perform(#selector(updateProgress), with: nil, afterDelay: 1.0)
animationProgress.frame = CGRect(x: 0, y: 0, width: prog, height: 85)
animationProgress.transform = animationProgress.transform.scaledBy(x: 1, y: 85)
self.contentView.addSubview(animationProgress)
您遇到的問題與子視圖的順序有關。 我不確定您使用的是哪個單元格,您如何以及何時添加其他標簽。 但是看起來您需要將UIProgressView
發送到后面。
在您的情況下,修復應該在調用self.contentView.addSubview(animationProgress)
之后確保將子視圖發送到后面,這意味着調用self.contentView.sendSubviewToBack(animationProgress)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.