2011-10-26 13 views
0

テーブルビューに配列の配列を設定しましたが、セルラベルとしてテキストを表示する方法がわかりません。テーブルビューのセルにテキストラベルを表示する方法

文字列を、配列内の配列の "0"の位置にテキストラベルとして使用します。

ありがとうございました。ここで

は私のコードです:

- (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; 
} 

答えて

0

あなたは、配列の配列を持っているので、あなたは配列内の配列にアクセスする必要があります。

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

この取得はインデックスindexPath.row(テーブルの行の配列です)exercisesArrayから。

[excersizeArray objectAtIndex:indexPath.row] 

これは、その配列(内部配列)から(あなたが暗示している)文字列を取得します。

+0

ありがとうございました! – novicePrgrmr

関連する問題