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];
        }
    }
  • 相关阅读:
    Some good websites for C++
    Static Class in C#
    js提示后跳转代码集合
    日期格式化函数
    URL伪静态
    正则的一些使用
    提高.net网站的性能
    验证DropDownList的方法
    用C#去除字符串中HTML的格式
    drepdownlist不能动态绑定数据的原因
  • 原文地址:https://www.cnblogs.com/hubj/p/2509600.html
Copyright © 2011-2022 走看看