Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to make like iPhone progressbar in Apple Watch?

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?

like image 264
chirag shah Avatar asked Apr 07 '15 09:04

chirag shah


2 Answers

The most simple way for a solid-color progress bar in watchOS 2+ requires 1 image:

  1. Add a group where you want the progress bar. The group should have the size of the bar at 100%.
  2. Add a WKInterfaceImage to the group with an image of solid color.
  3. In your code, call 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.

like image 73
Fizker Avatar answered Oct 14 '22 06:10

Fizker


There is not a progress bar in WatchKit at the moment.

Workaround

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.

like image 26
cnoon Avatar answered Oct 14 '22 06:10

cnoon