Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

Can not change color of Progress Bar #14

Closed
milanvthakor opened this issue May 25, 2020 · 9 comments
Closed

Can not change color of Progress Bar #14

milanvthakor opened this issue May 25, 2020 · 9 comments
Assignees

Comments

@milanvthakor
Copy link

Hi!
I am trying to change progress bar color to yellow.
But it still showing default blue color.
I have tried the code available in Demo project but it's not working.

Thank you.

@Recouse
Copy link
Owner

Recouse commented May 25, 2020

Hi.
Have you tried to change progressBarColor value?

@Recouse Recouse self-assigned this May 25, 2020
@milanvthakor
Copy link
Author

Yes. I have tried to change value of progessBarColor.
But it's not changing.

@Recouse
Copy link
Owner

Recouse commented May 28, 2020

Can you show some code examples?

@milanvthakor
Copy link
Author

Sorry for the late reply.

I am using below code.

let progressBar: LinearProgressBar = {
let progressBar = LinearProgressBar()
progressBar.progressBarColor = .systemYellow
return progressBar
}()

@Recouse
Copy link
Owner

Recouse commented Jun 2, 2020

Did you set a frame of progressBar or added some constraints?

@milanvthakor
Copy link
Author

No. I just added programmatically upon the webView.
Here is the code.

import MaterialProgressBar

let progressBar: LinearProgressBar = {
let lProgressBar = LinearProgressBar()
lProgressBar.progressBarColor = .systemYellow
return lProgressBar
}()

@IBOutlet weak var webView: WKWebView!

override func viewDidLoad() {
super.viewDidLoad()

//adding progress bar to webview
webView.addSubview(progressBar)
progressBar.startAnimating()

}

I am just displaying progressBar on top of webView

@Recouse
Copy link
Owner

Recouse commented Jun 3, 2020

You should set a frame or add constraints to place a progress bar in view.

You can also use UIViewController extension to show/hide a progress bar on the top of the view controller.
From README

// Start animating
showProgressBar()

// Stop animating
hideProgressBar()

@milanvthakor
Copy link
Author

Ok. So i have added constraint to progressBar and it is showing at correct place with the custom color.
But I notice some problem.
showProgressBar() method create the one new default progressBar by its self with the default blue color and this method is not working with progressBar i have created.

And same with hideProgressBar() method, it's only hiding progressBar created by showProgressBar() method and not hiding my custom progressBar.

I have checked in your demo example also. You can see, you have created only three progressBar, but its showing 4(blue one at top). And hide button is only hiding that blue progressBar not the other three in stackView.

@Recouse
Copy link
Owner

Recouse commented Jun 3, 2020

showProgressBar() and hideProgressBar() methods are UIViewController extension methods.
showProgressBar() adds view on the top of the view controller, and hideProgressBar() removes it.

I think your issue is resolved and I can close it. Reopen this or create a new one if you have any other questions.

@Recouse Recouse closed this as completed Jun 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants