Jes*_*ica 3 xcode objective-c uitableview ios
我有一个简单的iOS应用程序项目,我一直在努力.tableview显示从Web服务(rss feed)获取的条目,并点击其中一个segue到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];
}
Run Code Online (Sandbox Code Playgroud)
上面的代码导致以下结果:

我想要的是细胞被模糊以表明它已被阅读.我将来自TechCrunch iPhone应用程序的以下图像作为我想要的示例:

提前致谢.
更新: 我尝试更改didSelectRowAtIndexPath中的文本颜色,但它不起作用:
ItemsViewCell *cell = (ItemsViewCell *)[tableView dequeueReusableCellWithIdentifier:@"ItemsCell"];
cell.titleLabel.textColor = [UIColor redColor]; //Red color is just for checking right now
Run Code Online (Sandbox Code Playgroud)
小智 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];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
561 次 |
| 最近记录: |