相当于Android上的Android ViewPager?滑动/翻阅数据页面 [英] Equivalent to the Android's ViewPager on iOS? Swipe/flip through pages of data

查看:120
本文介绍了相当于Android上的Android ViewPager?滑动/翻阅数据页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android上,使用ViewPager和Fragments可以通过相同的布局在几页数据之间进行浏览。用户向左或向右滑动,页面也会改变。所有页面只有一个视图控制器和一个布局资源,但用户浏览时数据内容会发生变化。左右滑动也有动画效果,您可以看到下一页的内容已经加载。

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. There's only one view controller and one layout resource for all pages, but the data content changes when the user browses. There's also an animation effect to the swiping left and right where you can see the content of the next page is already loaded.

在iOS上有什么相同的?

What is the equivalent to this on iOS?

推荐答案

使用 UIScrollView pagingEnabled 属性设置为YES。通常是 UIPageControl 与它一起使用。

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

如果您使用Google进行UIScrollView分页,您可以找到许多教程和示例。 Apple提供 PageControl 示例程序。

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

iOS不提供任何类型的类适配器类,但这里有一个教程,解释了如何实现虚拟页面,这样您就不必一次实例化所有页面:< a href =http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview.html> http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview .html

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

这篇关于相当于Android上的Android ViewPager?滑动/翻阅数据页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆