zoukankan      html  css  js  c++  java
  • three20 用more button 分页,自动加载更多行

    参考原文:http://code.coneybeare.net/three20-how-to-autoload-more-results-when-you

    下面的我的代码

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    - (void)tableViewDidLoadModel:(UITableView*)tableView {
        
        NSMutableArray* items = [[NSMutableArray alloc] init];
        for (TSBazaarInfo* post in _searchFeedModel.posts) {
            
            [items addObject:
             [TSBazaarListItem itemWithTitle:post.title caption:[NSString stringWithFormat:@"%@ | %@ | Post by %@",post.area_name,[post.created formatRelativeTime],post.username]
                                    text:post.content price:post.pricetext contentid:post.contentid imageURL:post.icon URL: [NSString stringWithFormat:@"tt://bazaar/getone/%d",post.contentid]]];
        }
        
        if(!([items count]%10))[items addObject:[TTTableMoreButton itemWithText:@"More"]];
        self.items = items;
        TT_RELEASE_SAFELY(items);
    }
    
    - (void)tableView:(UITableView*)tableView cell:(UITableViewCell*)cell willAppearAtIndexPath:(NSIndexPath*)indexPath {
        [super tableView:tableView cell:cell willAppearAtIndexPath:indexPath];
        if (indexPath.row == self.items.count-1 && [cell isKindOfClass:[TTTableMoreButtonCell class]]) {
            TTTableMoreButton* moreLink = [(TTTableMoreButtonCell *)cell object];
            moreLink.isLoading = YES;
            [(TTTableMoreButtonCell *)cell setAnimating:YES];
            [tableView deselectRowAtIndexPath:indexPath animated:YES];
            [self.model load:TTURLRequestCachePolicyDefault more:YES];
        }
    }
  • 相关阅读:
    H公司以及我的目标
    新的起点
    apache服务器配置Net的实践
    会计简要学习
    二、MongoDB的简单增删改查
    一、MongoDB安装与启动
    KnockOutJs初次体验
    DevExpress 全体窗口换肤的功能 winform
    DevExporess 右键菜单的实现
    使用gridControl gridview总结
  • 原文地址:https://www.cnblogs.com/hubj/p/2509600.html
Copyright © 2011-2022 走看看