alskipp / ASProgressPopUpView

A progress view showing percentage complete in a popup view
MIT License
1.12k stars 162 forks source link

ProgressView color change #8

Closed nhjariwala closed 9 years ago

nhjariwala commented 9 years ago

Hi I loved this library and thanks for such a awesome work. I have implemented it into my project and it works like charm. But I have facing some strange issue. I have used Tab on my project in which on my first tab I have used progressView into TableViewCell. When I run the project ProgressView display the same color that have been set by me it looks like below image.

screen shot 2015-09-11 at 3 55 19 pm

But When I changed my tab (means from 1st Tab to 2nd Tab and then back to 1st Tab) then the progress colour changed it looked like below image

screen shot 2015-09-11 at 3 55 47 pm

Don't know whats wrong with it.. Banging my head from last several hours. Thanks

alskipp commented 9 years ago

Hmm, that's a pain. Are you using animated colors, or is the popUpView a constant color throughout?

alskipp commented 9 years ago

If you're using animated colors, could you try the following quick hack: reset the animated colors when the tab changes? self.progressView.popUpViewAnimatedColors = …

nhjariwala commented 9 years ago

No I am not using animated colors. Please have look my code

func initProgressPopUp() {
    myProgressPopUpView.progress = 0
    myProgressPopUpView.popUpViewCornerRadius = 12.0
    myProgressPopUpView.font = UIFont(name: "Futura-CondensedExtraBold", size: 28)
    myProgressPopUpView.popUpViewColor = UIColor(red: 0.0/255.0, green: 184.0/255.0, blue: 226.0/255.0, alpha: 1)
}

func setProgress(destination: Double) {
    tar = Double(destination/100)
    progress()
}

func progress() {
    myProgressPopUpView.showPopUpViewAnimated(true)
    let TIMES = 0.05
    var progress = myProgressPopUpView.progress
    if progress < Float(tar) {
        progress += 0.005
        self.myProgressPopUpView.setProgress(progress, animated: true)
        var timer = NSTimer.scheduledTimerWithTimeInterval(TIMES,
            target: self,
            selector: Selector("progress"),
            userInfo: nil,
            repeats: false)
    }
}

Thanks

alskipp commented 9 years ago

Does it help to set autoAdjustTrackColor to NO?

nhjariwala commented 9 years ago

Let me check it and let you know in 2 min

nhjariwala commented 9 years ago

It will change the color of my progressView. Now progressView look like this

screen shot 2015-09-11 at 4 56 32 pm

It look same when load first time and when tab switched.

alskipp commented 9 years ago

Ok, we're making progress ; ) Could you then set the progressTintColor to the appropriate color afterwards. This might fix the problem (though it is a bit of a hack).

nhjariwala commented 9 years ago

Bravo .... It works man .... you are life saviour :+1:

Thank you so much for your help.... ;)

alskipp commented 9 years ago

Glad it's working for you now : ) Though the problem you experienced is clearly a bug. I'll have to look into it. If you are able to post a demo project that demonstrates that problem it would be really helpful – understand if this is not possible though.

All the best, Al

nhjariwala commented 9 years ago

I will create demo project for you and send it to you soon .. But it will be in Swift version hope you don't mind about it.

alskipp commented 9 years ago

Swift is good :+1:

nhjariwala commented 9 years ago

Great .. I will send you soon. Thanks again