And*_*lip 3 objective-c uiscrollview uigesturerecognizer ios
我有一个UIPanGestureRecognize用来改变视图框架的东西.有没有一种方法来模拟的减速UIScrollView或UITableView当手势的状态UIGestureRecognizerStateEnded?这是我目前的代码:
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
}
}];
}
Run Code Online (Sandbox Code Playgroud)
但这不是一个平滑的卷轴.我希望减速直到它停止到我设定的位置.谢谢
Jef*_*eff 14
WWDC 2012上的会议223,"利用滚动视图增强用户体验",介绍了使用滚动视图的行为和"感觉"来设置不同视图位置动画的方法(滚动视图实际上对用户不可见).
会话中显示的方法的好处是您的减速将始终与UIScrollView匹配,现在和永远.
https://developer.apple.com/videos/wwdc/2012/?id=223
| 归档时间: |
|
| 查看次数: |
3359 次 |
| 最近记录: |