#define TIME_INTERVAL 1.3f
[self performSelector:@selector(autoRun)
withObject:nil
afterDelay:TIME_INTERVAL
];
- (void)autoRun {
if (!canfloat) {
return;
}
// do logic
[self performSelector:@selector(autoRun)
withObject:nil
afterDelay:TIME_INTERVAL
];
stepIndex ++;
}
- (void)floatView:(UIView*)view rect:(CGRect)rect {
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:TIME_INTERVAL];
[view setFrame:rect];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:view cache:YES];
[UIView commitAnimations];
}