Changes between Version 28 and Version 29 of entity


Ignore:
Timestamp:
01/04/2012 11:44:53 AM (14 years ago)
Author:
leijingtang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • entity

    v28 v29  
    7777 
    7878- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
     79    static NSString *identifier = @"BrowseLocalController"; 
     80    PCButtonTableCell *cell = (PCButtonTableCell *)[tableView dequeueReusableCellWithIdentifier:identifier]; 
    7981     
     82    NSDictionary *cellConfig = [self.config objectForPath:PCUI_CONTENT_VIEW, PCUI_TABLE_VIEW, PCUI_TABLE_CELL, nil]; 
     83    NSInteger countPreRow = n; 
     84 
     85    // 网格的按钮都使用同一个回调方法,可以使用网格的tag来进行区分; 
     86    if (!cell) { 
     87        cell = [[PCButtonTableCell alloc] initWithConfig:cellConfig countPreRow:countPreRow target:self action:@selector(clickGrid:) style:UITableViewCellStyleDefault reuseIdentifier:identifier]; 
     88        [cell autorelease]; 
     89    } 
     90     
     91    // 每次调用这个方法都必须配对调用showControllerFrom:和hideControlFrom:,因为单元格有重用机制,这样做可以保证单元格在重用以后可以显示正确的网格数。 
     92    // 如果需要自定义网格,这两个方法也必须被覆盖。子类必须调用父类实现,并实现额外的控制。 
     93    [cell showControlFrom:0]; 
     94    for (NSInteger i=0; i<countPreRow && i<itemCountForThisRow; i++) { 
     95        PCButton *button = [cell getButon:i]; 
     96        NSInteger itemIdx = i + indexPath.row * countPreRow; 
     97         
     98        [button setUri:small_url defaultImage:[UIImage imageWithKey:@"album@2x.png"]]; 
     99        button.tag = itemIdx; 
     100         
     101        UILabel *label = [cell getLabel:i]; 
     102        label.text = @"content" 
     103    } 
     104    [cell hideControlFrom:itemCountForThisRow]; 
     105     
     106    return cell; 
    80107} 
    81108