ios - UITableView and new methods for tvOS -
i creating test tvos app. have image (outside tableview) , when "focused" not selected, image change... know apple has added couple methods focus. tell me methods use change image when in "focus"? , how use it? use method:
- (bool)tableview:(uitableview *)tableview canfocusrowatindexpath:(nsindexpath *)indexpath
or use:
- (void)tableview:(uitableview *)tableview didupdatefocusincontext:(uitableviewfocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator
please let me know! thank you!
if want change image when uitableviewcell
item focus, should use second method.
- (void)tableview:(uitableview *)tableview didupdatefocusincontext:(uitableviewfocusupdatecontext *)context withanimationcoordinator:(uifocusanimationcoordinator *)coordinator { //you can focused indexpath below nsindexpath *nextindexpath = [context nextfocusedindexpath]; // image data source, assume have images array uiimage *image = [_imagesarray objectatindex:nextindexpath.row]; // set image image view, assuming have property imageview _imageview.image = image; }
Comments
Post a Comment