Equivalent to the Android's ViewPager on iOS? Swipe/flip through pages of data

前端 未结 5 1212
夕颜
夕颜 2021-01-30 06:51

On Android there\'s neat way to browse between several pages of data with the same layout by using ViewPager and Fragments. User swipes left or right, and the pages change. Ther

5条回答
  •  醉梦人生
    2021-01-30 07:24

    Use a UIScrollView with the pagingEnabled property set to YES. Typically a UIPageControl is used along with it.

    If you Google for "UIScrollView paging", you can find many tutorials and examples. Apple provides a PageControl sample program.

    iOS doesn't provide any sort of adapter-like class, but here is a tutorial that explains how to implement "virtual pages" so that you don't have to instantiate all the pages at once: http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview.html

提交回复
热议问题