开发者

Is it possible to make UITable continuous?

开发者 https://www.devze.com 2023-03-25 13:34 出处:网络
I would like to make an UITable continuous, which means that when the user scrolls to the top row he can keep scrolling up and see the bottom content.

I would like to make an UITable continuous, which means that when the user scrolls to the top row he can keep scrolling up and see the bottom content.

Example:

if this is the normal configurati开发者_JS百科on:

-- row 1 --

-- row 2 --

-- row 3 --

-- row 4 --

I'd like it to appear as if it was:

...

-- row 3 --

-- row 4 --

-- row 1 --

-- row 2 --

-- row 3 --

-- row 4 --

-- row 1 --

-- row 2 --

...

Thanks !


As I understand correctly, you want some kind neverending table. I am afraid that implementation of UITable does not allow this.


There is API in a the iOS 5 beta that will let you do this. Since it hasn't been released yet, that's all I'm going to say. Go find it, and then ask questions on http://devforums.apple.com (or wait for iOS 5 to be released "this fall").

Another option is to report a very large number of rows (like, say, 100000) in your UITableView, and then silently adjust the scroll location of the tableview whenever it stops scrolling. ([tableView scrollToRowAtIndexPath:anIndexPath animated:NO];) You might have issues with preserving the exact scroll location, but you might be able to work around that as well by maybe using setContentOffset:animated:? I'm not quite sure; I'd have to try it.

In practice however, it usually works. For example, this is how UIDatePicker achieves its "infinite" scrolling when displaying dates. However, the row positioning constraints on UIDatePicker are different than they are on UITableView, but the principle is the same...


You can't do this based on the UITableView.

A tableview is a quite encapsulated type of element, which only interacts with your code at the points where you configure it (as far as it is configurable) and where it asks for data to populate itself with.

So, instead of feeding it with whatever you'd like it to show, you need to wait until it asks its delegate for data, and even then all you have is the opportunity to give it what it needs - the cell for a specific location within the table.

I'm afraid you will have to do it from scratch.


check out this question : How to make an never ending UITableView? . However, all these methods are only hacks that won't work forever! As everone is saying, I'm afraid you'll have to start from scratch, possibly just circulating UIViews , each containing a cell, by manipulating their frames!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号