【发布时间】:2015-12-31 06:19:41
【问题描述】:
如何更改“聚焦”的 UITableView 单元格的字体颜色?我现在有这个....
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
if (context.nextFocusedView) {
CategoryCell *cell = [self.categoryTableView dequeueReusableCellWithIdentifier:@"CategoryCell"];
[cell.categoryLbl setTextColor:[UIColor orangeColor]];
}
}
我知道如果你想改变一个聚焦的 UITableViewCell 的背景,它会是:
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
[context.nextFocusedView setBackgroundColor:[UIColor clearColor]];
[context.previouslyFocusedView setBackgroundColor:[UIColor orangeColor]];
}
【问题讨论】:
-
上述问题是您正在创建新单元格(dequeueReusableCellWithIdentifier),而不是修改现有单元格。请参阅下面有关使用 cellForRowAtIndexPath 的答案。
标签: objective-c uitableview tvos