我有一个 UIPanGestureRecognize
,用于改变视图的框架。当手势的状态为 UIGestureRecognizerStateEnded
时,有没有一种方法可以模拟 UIScrollView
或 UITableView
的减速效果?这是我的当前代码:
if (panGesture.state == UIGestureRecognizerStateEnded)
{
[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
self.view.frame = CGRectMake(182, 0, self.view.frame.size.width, self.view.frame.size.height);
}
completion:^(BOOL finished) {
if (finished) {
//Do something
}
}];
}
但这不是平滑滚动。我想要的是一种减速到达我设定的点并停止的效果。谢谢。