[UIView animatewithduration:0.5 animations:^{for (i = num; i > _indexofarray+1; i--) {(UID Ragbutton *) [_buttonarray objectatindex:i]). frame = ((Uidragbutton *) [_buttonarray objectatindex:i-1]). Frame; } ((Uidragbutton *) [_buttonarray objectatindex:i]). frame = _framerect; }];
You only need to assign values directly in the block to achieve the effect.
If using cabasicanimation is more complex
Defining animations
-(Cabasicanimation *) MoveX: (float) time x: (NSNumber *) x//lateral movement {cabasicanimation *animation=[cabasicanimation Animati onwithkeypath:@ "Transform.translation.x"]; Animation.tovalue=x; Animation.duration=time; Animation duration Animation.removedoncompletion=no; Animation.fillmode=kcafillmodeforwards; Animation.delegate = self; return animation;}
Using animations
[Self.layer addanimation:[self movex:0.1 x:[nsnumber numberwithfloat:x]] forkey:nil];
Contract Requirements <NSObject>
Simple implementation of IOS mobile animations