简体   繁体   English

如何为iOS创建类似于Google Maps的用户卡动画

[英]how to create a user card animation like google maps for iOS

In the new google maps for iOS when you search for a place, it has a card on the bottom that you can drag/animate up and down. 在iOS版新版Google地图中,当您搜索地点时,它的底部有一张卡片,您可以上下拖动/设置动画。 I am trying to replicate this by using a UIPanGestureRecognizer on a UIViewController's view, however when I flick up I wanted it to animate smoothly like it does on Google Maps. 我试图通过在UIViewController的视图上使用UIPanGestureRecognizer来复制此内容,但是,当我轻弹时,我希望它可以像在Google Maps上那样平滑地进行动画处理。 How can achieve this effect? 怎样才能达到这种效果? When I tap and hold on it works just fine. 当我点击并按住时,效果很好。

Calculate the speed that you want it to move at (possibly the speed of the flick, possibly less if that is too fast), then use animateWithDuration:animations: to animate the view to its final position. 计算您希望其移动的速度(可能是轻拂的速度,如果太快则可能会减小 ),然后使用animateWithDuration:animations:将视图设置为最终位置。 Set the duration such that it moves at the speed you want it to move. 设置持续时间,使其以所需的速度移动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM