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. rectangle progress bar

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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -