TVOS , detect indexPath FocusUpdate



如何使用此代码或获取并检测collectionView中聚焦项目的indexPath?

- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{}

使用didUpdateFocusInContect-UICollectionViewDelegate

func collectionView(collectionView: UICollectionView, didUpdateFocusInContext context: UICollectionViewFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
     // indexPath that is going to be focused
     print(context.nextFocusedIndexPath)
     // indexPath that is going to lose focus
     print(context.previouslyFocusedIndexPath)
}

相关内容

  • 没有找到相关文章

最新更新