2011-02-23 20 views

回答

1

您可能想獲取從陣列WRT(indexPath.row -1)的數據,如果你正在使用數組填充表

1
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

if(indexPath.row==0) 
{ 
//return blank cell; 
} 

//add cell contents 

return cell; 

} 
+0

我這樣做,但有一個問題,只要我插入我的數組,然後插入從0索引開始。 – Nitin 2011-02-23 08:32:57

+0

使用[array objectAtIndex:indexPath.row-1] – KingofBliss 2011-02-23 08:34:30

0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

     static NSString *CellIdentifier = @"Cell"; 

     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
     if (cell == nil) { 
      cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
     } 

     // Configure the cell. 
     NSIndexPath *path1 = [NSIndexPath indexPathForRow:indexPath.row+1 inSection:indexPath.section]; 
     [self configureCell:cell atIndexPath:path1]; 

     return cell; 

} 

我沒有測試它,但它應該工作,試試吧

相關問題