0

行が 5 を返す場合の私の質問UITableViewでは、0 から 5 の index が表示されますが、3 から 5 の任意のロジックを出力したい ??` // セル識別子を作成します static NSString *CellIdentifier = @"CellIdentifier";

// Create the cell if cells are available with same cell identifier
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

// If there are no cells available, allocate a new one with Default style
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

cell.textLabel.text = [[no objectAtIndex:indexPath.row]valueForKey:@"name"];
// Configure cell...

値のカスタマイズ範囲を印刷できますか

4

1 に答える 1

0

あなたのソリューションはこれで、完全に機能しています:

.h で

Bool drawCell; メートルで

- (void)viewDidLoad
{
drawCell=NO;
}    
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{        
UITableViewCell *cell = nil;
if(indexPath.row==3)
{
 drawCell=YES;
}
if(drawCell)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
cell.textLabel.text = [[no objectAtIndex:indexPath.row]valueForKey:@"name"];
}
else
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
    cell.frame=CGRectMake(0, 0, 0, 0);
}

return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (drawCell) {
    return 100.0f;
} else {
    return 0.0f;
}
}
于 2013-03-08T11:13:25.420 に答える