0
的幫助爲什麼indexPath.Row總是返回0 ???在下面的方法中需要NSIndexPath
- (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.
[cell.textLabel setText:[mainItems objectAtIndex:indexPath.row]];
return cell;
}
mainItems是NSMutableArray的,有5個項目( 「項目1」, 「項目2」,...)的View也獲得5項......但他們都 「項目1」,而不是項目1,第2項...
我做錯了什麼?
tks很多...事實上,我設置部分= [mainItens計數],而不是項目!我會盡快標記爲正確的! – Leonardo