swift - How To Implement A Circular Loader without SKShapeNode -


i want creat simple circular loader animation circle , border around disappearing

i found great frameworks use skshapenode , skshapenode performance terrible actual deployed app

progressnode: cool framework

you use uiview within uiimageview "loading circle" image , let rotate it. here example class:

import uikit  class circularloadingview: uiview {      @iboutlet weak var rotatingimage: uiimageview!     let duration: double = 1      func startanimation() {         let animation = cabasicanimation(keypath: "transform.rotation.z")         animation.tovalue = nsnumber(floatliteral:  m_pi * 2.0 * duration)         animation.duration = duration         animation.iscumulative = true         animation.repeatcount = float(cgfloat.greatestfinitemagnitude)         rotatingimage.layer.add(animation, forkey: "animationkey")          uiview.animate(withduration: duration, animations: {             self.alpha = 1         })     } } 

just add uiview , set circularloadingview custom class. add uiimageview, set image want rotate, set outlets , constraints , see happens.

but attempt need image, have create or find.

if not you, perhaps old raywenderlich tutorial can. there show how make circular indicator cashapelayer.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -