如何制作一个永无止境的UITableView? [英] How to make an never ending UITableView?
问题描述
我在UITableView中有一些选项,希望用户可以永远滚动.到达终点时,我想附加开始内容,以便用户可以继续滚动.
I have some options in an UITableView and want that the user can scroll forever. When the end is reached, I want to append the begginning so the user can continue to scroll.
我该怎么做?
推荐答案
在 tableView:numberOfRowsInSection:
中返回一些巨大的数字,并相应地在 tableView:cellForRowAtIndexPath:
中采取行动一遍又一遍地返回相同的细胞.
In tableView:numberOfRowsInSection:
return some huge number, and act accordingly in tableView:cellForRowAtIndexPath:
by returning same cells over and over.
您还可以限制行数,最后显示一个不同的单元格-包含一个供用户添加新行的按钮.单击该按钮后,您只需调用 [tableView reloadData]
并在表的数据源中提供更多行.
You can also have limited number of rows, and at the end show a different cell - containing a button for user which he can use to append new rows. When that button is clicked you simply call [tableView reloadData]
and provide more rows in table's data source.
您不是偶然将表格视图误用为不合适的内容吗?也许您最好只使用UIScrollView并在用户滚动时重新定位子视图.
Aren't you by any chance misusing the table-view for something it doesn't fit that well ? Maybe you would be better off using just a UIScrollView and reposition subviews as user scrolls over.
这篇关于如何制作一个永无止境的UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!