i new core graphics, , know how possible draw rings gradients similar apple watch fitness app. trying on ios app, think core graphics not supported on watchkit yet.
i found tutorial on following website draw rings.
http://makeapppie.com/2015/03/10/swift-swift-basic-core-graphics-for-the-ring-graph/
however trying figure out how add gradient stroke color. far based on have found there no straight forward way this. in order achieve this, figured need find answers following:
- is there api create circular gradients in core graphics?
- is possible apply gradient stroke color in core graphics?
thanks
you have must find answer of question answer trying create same thing.
firstly need create images 1-100(naming them importing careful names) create ring animation. can use app in simulator create ring images:
after should import animation images project(it doesn't matter if import them in .xcassets or in folder make sure images target watch app not watch app extention or ios app)
after can create animation this:
override func awakewithcontext(context: anyobject?){ super.awakewithcontext(context) imageview.setimagenamed("ringimage-") } override func willactivate() { imageview.startanimatingwithimagesinrange(nsmakerange(1, 46), duration: 1, repeatcount: 1) //this code animate ring ringimage-1 ringimage-46 }
hope helps.