jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

Progress Doesn't Update - Swift #271

Closed ghost closed 9 years ago

ghost commented 9 years ago

I have the following method below that is getting some errors when I attempt to update. Note: This method below is called from the main thread...

I am getting the following error: : void CGPathAddArc(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, bool): invalid value for start or end angle

    func update(){
        var hud = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
        hud.labelText = "Please wait..."
        hud.mode = MBProgressHUDMode.Determinate

        if (uploadSize == amountUploaded){

        }
        else{
            println("the amount: \(Float(uploadSize - amountUploaded))")
            hud.progress = Float(uploadSize - amountUploaded)
        }
    }

It is called from another method like this:

dispatch_sync(dispatch_get_main_queue(), { () -> Void in
                self.amountUploaded = totalBytesSent
                self.uploadSize = totalBytesExpectedToSend;
                self.update()

            })
matej commented 9 years ago

Perhaps Float(uploadSize - amountUploaded) is negative.

ghost commented 9 years ago

yes.. my mistake. thanks.