如何使用setAnimationStartDate? 以下代码不起作用。
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3.0];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:3];
[UIView setAnimationStartDate:date];
CGPoint point = _imageView.center;
point.y += 150;
[_imageView setCenter:point];
[UIView commitAnimations];
最佳答案
您可以使用基于 block 的动画。它们更干净,可以完全满足您的需求。一种方法是 +[UIView animateWithDuration:delay:options:animations: completion:]
。 delay
参数在您的情况下会很有用。这是一个例子。
[UIView animateWithDuration:10
delay:3
options:UIViewAnimationOptionCurveEaseIn
animations: ^{
CGPoint point = _imageView.center;
point.y += 150;
[_imageView setCenter:point];
}
completion: ^(BOOL finished) {
NSLog(@"Animation Complete");
}];
您可能不得不乱用 delay
来模仿您的 NSDate
设置。
关于ios - 如何在UIView中使用setAnimationStartDate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27761892/