3

私が取り組んでいる単純な iOS アプリ プロジェクトがあります。テーブルビューには、Web サービス (RSS フィード) から取得されたエントリが表示され、そのうちの 1 つをタップすると Web ビューに移動します。

以下を使用して、項目が読み取られたかどうかを確認しています。はいの場合は、setAccessoryType を使用してチェック マークを付け、項目が読み取られたことを示します。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    ItemFeed *entry = [[channel items] objectAtIndex:[indexPath row]];

    [[MyFeedStore sharedStore] markItemAsRead:entry];
    [[[self tableView] cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];

}

上記のコードの結果は次のようになります。

ここに画像の説明を入力

私が望むのは、セルが読み取られたことを示すためにセルをぼかすことです。私が欲しいものの例として、TechCrunch iPhoneアプリから次の画像を入れています:

ここに画像の説明を入力

前もって感謝します。

更新: didSelectRowAtIndexPath でテキストの色を変更しようとしましたが、うまくいきませんでした:

ItemsViewCell *cell = (ItemsViewCell *)[tableView dequeueReusableCellWithIdentifier:@"ItemsCell"];
cell.titleLabel.textColor = [UIColor redColor]; //Red color is just for checking right now
4

2 に答える 2

5

次のコードを追加してみてください。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  {
    ItemsViewCell *cell = (ItemsViewCell*)[tableView cellForRowAtIndexPath:indexPath];
    cell.titleLabel.textColor = [UIColor redColor]; //Red color is just for checking right now
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
于 2013-04-19T12:33:30.463 に答える