开发者

animate pan gesture

i have wrote a subclass of UIView, which in drawRect: draws itself. it is actually something like day-long timeline for movie - it draws time axis with ticks and time text labels. it can be zoomed in up to seconds and zoomed out up to all 24 hours. when its zoomed in, it could be scrolled with pan gesture. s开发者_JAVA技巧o here is the question: how can i implement simple animation, when the finger is lifted, timeline continues to scroll for a while and then stops (with negative acceleration)?

two ideas comes to my mind:

  1. implement animation by myself using another thread
  2. make new class - a subclass of CALayer and then use CABasicAnimation. add this class to the layers of my view. but here i should totally move all my code written for view to new subclass of CALayer, what i dont want to do. would it be ok?

any other ideas?


Wouldn't it be easier to integrate the view in a UIScrollView, let that handle the scrolling and zooming and let your class just do the drawing?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜