Reputation: 3016
Hello all i am new in Apple Watch development and Is there any way to display progress bar in Apple Watch? I have one application in which there is progress bar which updated with user location. i implemented same thing in iPhone but now i want to implement same thing in Apple Watch. Is there any possible way to do this?
Upvotes: 5
Views: 2551
Reputation: 1
I have found an easier way.
You can do it using two groups. The process similar as Fizker's answer.
progressGroup.setRelativeWidth(CGFloat(currentValue / maxValue), withAdjustment: 0)
Upvotes: 0
Reputation: 2634
The most simple way for a solid-color progress bar in watchOS 2+ requires 1 image:
progressBarImage.setRelativeWidth(CGFloat(currentValue / maxValue), withAdjustment: 0)
whenever the current value changes.If you want a vertical progress bar, there is afunction for that: progressBarImage.setRelativeHeight(CGFloat(currentValue / maxValue), withAdjustment: 0)
.
You could also create the image dynamically on the phone. I leave this as an exercise for the reader.
Upvotes: 10
Reputation: 16663
There is not a progress bar in WatchKit at the moment.
A fairly easy workaround would be to design a WKInterfaceImage that looks like a progress bar along with the progressive images to fill in the bar. Then update the current image displayed to match the percentage that your user's location has progressed.
Upvotes: 4