gpt4 book ai didi

ios - 隐藏快速从不同文件中删除 subview

转载 作者:行者123 更新时间:2023-11-29 05:42:05 25 4
gpt4 key购买 nike

我正在将此文件中的进度 View 加载到不同的 View Controller 中,它显示正常,但不会删除。我尝试过 isHidden、removeFromSuperview()、使 alpha=0,但没有任何效果。我怎样才能摆脱它?

func timerAction(){

let progressHUD = ProgressHUD(text: "Taking Reading")
if(timerCounter <= 20){
self.vc!.view.addSubview(progressHUD)
timerCounter += 1
} else {
timer.invalidate()
timerCounter = 0
progressHUD.removeFromSuperview()
}
}


self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.timerAction), userInfo: nil, repeats: true)

最佳答案

每次调用计时器时,都会将新的 subview 添加到 View Controller 中。只需添加一次 subview “progressHUD”并更新它。

关于ios - 隐藏快速从不同文件中删除 subview ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56464359/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com