1

次のようにUITableView配列に表示したい:

(
    1,
        {
        date = 1351876762;
        ncom = 0;
        nid = 11739814;
        "read_ncom" = 0;
        text = "<div class=\"wikiText\"><!--4-->New note text </div>";
        title = lol;
        uid = 3795852;
    }
)

セルには、この配列の「タイトル」が付いたラベルが必要です。どうすればそれを作ることができますか?

PS:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    NSString *textCell = [[array objectAtIndex:indexPath.row] objectForKey:@"title"];
    cell.textLabel.text = textCell;
    return cell;
}

シグナルSIGABRTを返します。

ありがとう。

4

4 に答える 4

1

[編集]

あなたの配列は奇妙に思えます。フォローしてみて、結果を教えてください。

NSString *textCell = [[array objectAtIndex:1] objectForKey:@"title"];
于 2012-11-05T10:40:52.130 に答える
0

テーブルに識別子「Cell」のセルがあるか(ストーリーボードがある場合)、このセルを手動で作成する必要があります

if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
于 2012-11-05T10:40:21.107 に答える
0
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

cell.textLabel.text  = [[array objectAtIndex:1] objectforkey:@"title"];

上記のコードを試してください

于 2012-11-05T10:45:49.030 に答える
-1

これを置き換えます:

NSString *textCell = [[[array objectAtIndex:indexPath.row] objectForKey:@"1"]objectForKey:@"title"];
于 2012-11-05T10:43:31.633 に答える