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];
        }
    }
  • 相关阅读:
    linux 删除乱码文件
    snprintf用法
    面试时经常问到的非技术性问题
    vector查找元素
    new 和delete
    python安装
    UIPickerView详解
    设置文本框左边显示的View
    字符串的分割??
    VC++异常捕获??
  • 原文地址:https://www.cnblogs.com/hubj/p/2509600.html
Copyright © 2011-2022 走看看