Tuesday, 15 April 2014

ios - Move UIImageview in Curve -



ios - Move UIImageview in Curve -

i trying add together image , move on curve path. have half circle value 0 100. , want move image value.

this image of curve progress bar want rotate pointer on line.

if seek bezier curve wont able spot pointer . animation start end.

any help how can animate this.?

thanks

use next snippet of code making half circle path. replace spin button needle required utilize , provide angle move needle. i'm using code speedometer. hope helps you.

- (void)spinbutton : (uiview *)button : (float)angle { button.layer.anchorpoint = cgpointmake(0.5, 0.5); cabasicanimation *animation; animation = [cabasicanimation animationwithkeypath:@"transform.rotation.z"]; // testing // angle +=200; if(angle >=360){angle = 360;} animation.fromvalue = [nsnumber numberwithfloat:lastangle]; float m = angle/2 * (m_pi/180 ); animation.tovalue = [nsnumber numberwithfloat:(m)]; // [catransaction setvalue:[nsnumber numberwithfloat:1.0] forkey:kcatransactionanimationduration]; lastangle = m; // animation.duration = 1.0f; // stop animation @ lastly frame animation.fillmode = kcafillmodeforwards; animation.removedoncompletion = no; animation.timingfunction = [camediatimingfunction functionwithname: kcamediatimingfunctioneaseineaseout]; animation.autoreverses = no; [button.layer addanimation:animation forkey:@"rotationanimation"]; [catransaction begin]; // [catransaction commit]; }

you can phone call functions this:

[self spinbutton:btn :0]; dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(2.0 * nsec_per_sec)), dispatch_get_main_queue(), ^{ [self spinbutton:btn :50]; });

this way can accomplish desired result.

ios objective-c uiimageview uikit

No comments:

Post a Comment