0

I have populated a tableview with an array of arrays, but I do not know how to display text as the cell label.

I want to use the string in the "0" position of the array that is inside the array as the text label.

Thanks.

Here's my code:

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

    static NSString *CellIdentifier = @"cell";

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

    // Set up the cell...
    cell.textLabel.text = [excersizeArray objectAtIndex:indexPath.row];    
    return cell;
}
novicePrgrmr
  • 18,647
  • 31
  • 81
  • 103

1 Answers1

0

You need to access the array within the array since you have an array of arrays:

cell.textLabel.text = [[excersizeArray objectAtIndex:indexPath.row]objectAtIndex:0];

This get's the array at index indexPath.row (the table's row) from exercisesArray.

[excersizeArray objectAtIndex:indexPath.row]

This get's the string (as you implied) from that array (the inner array).

Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144