使用UIPageControl进行UITableview? [英] UITableview with UIPageControl?

查看:90
本文介绍了使用UIPageControl进行UITableview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作餐厅一步一步订购应用程序,我想在tableview中列出菜单(开胃菜,主菜等),并能够使用UIPagecontrol组织菜单内容。类似于eat24 app的方式,或者如何构建天气预报应用程序。

I am in the making of a restaurant "step by step" ordering app, where I want to list the menu (appetizers, main course etc) in a tableview with the ability to organize the menu contents with a UIPagecontrol. Something similar to the eat24 app way of doing it or how the weather forecast app is constructed.

I已经设置了tableview,现在我只需要实现这个,我希望你能帮助我或指导我正确的方向,让我完成这个:)。我是否需要为每个类别设置一个tableview,或者是否可以通过向左滑动或使用图片工具栏中的箭头更新一个包含所需信息的tableview?使用故事板添加像一张图片(白色环)的工具栏的最佳方法是什么?>调整桌面视图并将图像拖入或以编程方式设置它?

I already have the tableview set up, now I just need to implement this, which I hope you will help me with or guide me in the right direction, for me to accomplish this :). Would I need to setup a tableview for each of the categories or would it be possible to just update one tableview with the needed information, by swiping to the left or use arrows in a toolbar in the picture? What would the best way to add a toolbar like the one picture (white ring), using the storyboard -> resize tableview and drag the image in or to set it up programmatically?

推荐答案

选项1 - 更新tableView

您可以更新 dataSource ,以便它反映newtableView的状态。比调用 reloadSections:withRowAnimation:使用 UITableViewRowAnimationRight UITableViewRowAnimationLeft ,取决于目前适合的情况。这将感觉像滚动到新的tableView。对于滑动,您可以使用 UISwipeGestureRecognizer

Option 1 - Updating your tableView
You may update your dataSource so it reflects the state of the "new" tableView. Than you call reloadSections:withRowAnimation: by using UITableViewRowAnimationRight or UITableViewRowAnimationLeft, depending of whats fitting at the moment. This will feel like scrolling to a new tableView. For swiping you could use a UISwipeGestureRecognizer.

选项2 - 使用一个包含多个tableViews的scrollView

如果你想要它稍微简单一点,只需设置三个tableView并将它们放入 UIScrollView 并启用分页。

Option 2 - Using a scrollView with multiple tableViews
If you want it a little bit easier just setup three tableViews and throw them in a UIScrollView with paging enabled.

PageControl

当然你需要添加并设置一个 UIPageControl ,如果你想显示这些点。

PageControl
Of course you need to add and setup a UIPageControl, if you want to show those dots.

关于用户界面:


您可以设置故事板中的所有内容。背景,箭头按钮, UIPageControl ,你甚至可以在故事板中添加 UISwipeGestureRecognizer

Regarding the UI:
You can setup everything in your Storyboard. The background, the arrow buttons, the UIPageControl, you can even add the UISwipeGestureRecognizer within the Storyboard.

这篇关于使用UIPageControl进行UITableview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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