ios - How to custom rectangle progress bar? -
i want custom rectangle progress bar uikit attracted image. there source code that? cocos2d has same 1 ccprogresstimer can't find uikit source code.
create shapedlayer
cashapelayer *layer = [cashapelayer layer]; [layer setstrokecolor:[uicolor greencolor].cgcolor]; [layer setlinewidth:10.0f]; [layer setfillcolor:[uicolor clearcolor].cgcolor];
create rect radious want animate
uibezierpath *path = [uibezierpath bezierpathwithroundedrect:cgrectmake(10, 10, 300, 200) cornerradius:10.0f]; layer.path = path.cgpath; cabasicanimation *animation = [cabasicanimation animationwithkeypath:@"strokeend"]; animation.fromvalue = [nsnumber numberwithfloat:0.0f]; animation.tovalue = [nsnumber numberwithfloat:1.0f];
define animation duration
animation.duration = 4.0f; [layer addanimation:animation forkey:@"mystroke"];
add animation layer on want display
[self.view.layer addsublayer:layer];
Comments
Post a Comment