Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Swift] value of central labelview not updated in progressChangedBlock #10

Open
zyqu1990 opened this issue Jul 14, 2015 · 0 comments
Open

Comments

@zyqu1990
Copy link

Nice project!

I am integrating UAProgressView in my project written in swift. I tried to update the value of the current progress as follows:

override func awakeFromNib() {
    super.awakeFromNib()
    self.progressView.borderWidth = 2.0
    self.progressView.lineWidth = 8.0
    self.progressView.fillOnTouch = false
    self.progressView.animationDuration = 2.0

    self.textLabel = UILabel(frame: CGRectMake(0, 0, 60.0, 32.0))
    self.textLabel.font = UIFont(name: "HelveticaNeue-UltraLight", size: 22)
    self.textLabel.textAlignment = NSTextAlignment.Center
    self.textLabel.textColor = self.progressView.tintColor
    self.textLabel.backgroundColor = UIColor.clearColor()
    self.progressView.centralView = self.textLabel



    self.progressView.progressChangedBlock = { (progressView:UAProgressView!,  progress:Float) -> () in
        let lableview = progressView.centralView as! UILabel
        lableview.text = StringManager.float2str(progress*100)
        println("Current progress")
        println(progress)
    }  
} 

But the block is invoked only once as in the main code:

self.scoreshareview.setViewProgress(StringManager.str2float(score))

function setViewProgress:

func setViewProgress(score:Float){
    self.progressView.setProgress(score/100, animated: true)
}

I am new to iOS and not sure where the problem is.

Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant