开发者

iPhone Three20 TTTableMoreButton Loading More Rows

I've got an app called AppAdvice that seems to be using Three20. I've noticed they have a mechanism in place within most of the tableviews that will automatically load more results when you scroll down to the bottom of the 开发者_JS百科list and reveal the last row.

The also have an indicator in the last row that tells the user more items are loading then it disappears when the additional items are loaded. Once the last row is revealed the app requests more results.

Any clues on how they might be implementing this? The thing I can't figure out is how to append items to a table view and reposition the indicator row.

I know three20 has a tttablemorebutton, but I can't figure out how to use it.

http://ws.2wsx.ws/load_more_items.jpg

thanks, Howie


All the TTTableMoreButton does is call the following on your model (code is in TTTableViewDelegate)

- (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more 

if more is YES then _isLoadingMore flag is set. Test this in:

- (void)requestDidFinishLoad:(TTURLRequest*)request 

and then append the extra results onto your _items array instead of inserting them at the top.

Of course for all this to work you need to implement TTModel (override the model method in your datasource). For data-oriented applications, the best place to look is TTURLRequestModel and I'm sure there are examples of this in TTTwitter


I wrote up how to do this exactly here

This is setup using a list data source with a TTTableMoreButton as the last item. We just add a hook into the data source for when the more cell is about to be displayed, and then programmatically send the more request to load more items. You could tweak it so that it sends the more request earlier up the list, but I leave that to you.


the TTTwitter seems to be wrong,when i click the more Button,the following method runs twice,and first time more is true,second time more is false,so we can see that the table can't load data right.

- (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more 


I saw question and it inspired me to write a blog post for it. http://blog.grio.com/2012/03/thumbnail-view-of-large-number-of-photos-with-three20.html Hope it helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜