objective c - tableview, change font color of focus tvos -
how change font color of "focused" uitableview cell? have this....
- (void)didupdatefocusincontext:(uifocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator { if (context.nextfocusedview) { categorycell *cell = [self.categorytableview dequeuereusablecellwithidentifier:@"categorycell"]; [cell.categorylbl settextcolor:[uicolor orangecolor]]; } }
i know if want change background of focused uitableviewcell be:
- (void)didupdatefocusincontext:(uifocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator { [context.nextfocusedview setbackgroundcolor:[uicolor clearcolor]]; [context.previouslyfocusedview setbackgroundcolor:[uicolor orangecolor]]; }
in tvos
uitableviewdelegate
have new method tableview:didupdatefocusincontext:withanimationcoordinator:
called when focus change, can previous indexpath , nextfocusindexpath , can use tableview methods cells, code should this
- (void)tableview:(uitableview *)tableview didupdatefocusincontext:(uitableviewfocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator { nsindexpath *previndexpath = [context previouslyfocusedindexpath]; if (previndexpath) { uitableviewcell *cell = [self.tableview cellforrowatindexpath:previndexpath]; cell.textlabel.textcolor = [uicolor white]; } nsindexpath *nextindexpath = [context nextfocusedindexpath]; if (nextindexpath) { uitableviewcell *cell = [self.tableview cellforrowatindexpath:nextindexpath]; cell.textlabel.textcolor = [uicolor blackcolor]; } }
please visit apple docs more detail
Comments
Post a Comment