使用表视图控制器在部分文章之间导航/滑动 [英] Navigate/Swipe between articles in section using table view controller
本文介绍了使用表视图控制器在部分文章之间导航/滑动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的应用程序,它有包含几篇文章的表格视图控制器,例如体育部分的 3 篇文章:
I have a simple app which have table view controller containing few articles in sections, e.g. 3 articles in Sports section:
当我打开本节中的特定文章时,我希望能够向左滑动以移至本节中的下一篇文章,
我该怎么做?
When I open a specific article in this section I want to be able to swipe left in order to move to the next article in section,
How can I do it?
推荐答案
基本上,您需要创建
- 文章的全局存储,我们称之为
文章
.根据文章
,您可以填充tableView
. - 向打开的文章页面添加滑动手势识别器
- 每当您从右向左滑动时,您都会将一个新的视图控制器推送到您的导航堆栈,并使用
文章
的下一项设置此视图控制器.
- a global storage for your articles, let's call it
articles
. According toarticles
you can populate yourtableView
. - add a swipe gesture recognizer to your opened article page
- whenever you swipes from right to left, you push a new viewcontroller to your navigation stack, and setup this viewcontroller with the next item of
articles
.
这篇关于使用表视图控制器在部分文章之间导航/滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文