Infinite UIScrollView

2019-01-24 04:34发布

I would like to implement a timeline, much like one you can find in iMovie or Final Cut, which you can scroll in either direction. Scrolling to the left would go back in time ( months ) and scrolling to the right would go forward in time, creating a smooth continues path.

What would be the best way to implement this?

  • Do tricky things with UIScrollView
  • Subclass UIView and try to re-create inertial scrolling

A disadvantage of recreating the inertial scrolling is if Apple ever decides to change it that my app will feel weird. I personally do not like it when an app does not feel system integrated, this includes games like tower madness where they made their own scrollview which works really bad and feels wrong.

2条回答
混吃等死
2楼-- · 2019-01-24 05:02

Apple has and example project featuring infinite scrolling it's called StreetScroller, the description says:

Demonstrates how a UIScrollView subclass can scroll infinitely in the horizontal direction.

I hope this helps you.

查看更多
男人必须洒脱
3楼-- · 2019-01-24 05:07

StreetScroller can only support no paging mode. I wrote a class based on the StreetScroller and support paging & no paging at the same time. https://github.com/hellohalo/InfiniteScrollView

查看更多
登录 后发表回答