【发布时间】:2014-01-20 19:59:46
【问题描述】:
我正在构建一个博客阅读器应用,其中包含 NSArray 中的帖子对象列表。
cell.postTitle.text=post.Title;
我正在尝试找出哪个帖子已被选中,然后将相应的cell.postTitle.text 设置为较浅的字体。
当导航控制器重新回到顶层(并被销毁?)时,我必须以某种方式记住这个状态。
谁能告诉我最好的方法?每个 post 对象都有一个 postID。也许我可以将它存储在 NSUserDefault 中,但是随着时间的推移,读取的 postID 列表可能会变得太大。
还有didSelectRowAtIndexPath 但是在这种方法中,我不能直接访问单元格属性对吗?
【问题讨论】:
-
我做了 [super tableView: didSelectRowAtIndexPath:] ,这就是它崩溃的原因。但是我仍然无法更改字体。
if ([self.readPost containsObject:post.PostId]) { cell.postTitle.font = [UIFont fontWithName:@"Helvetica-Light" size:14]; } cell.postTitle.text=post.Title; cell.subTitle.text=[NSString stringWithFormat:@"%i points by %@ %@", post.Points, post.Username, post.TimeCreatedString]; return cell;
标签: ios objective-c uitableview