TVOS , 检测 indexPath FocusUpdate
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)
}
如何使用此代码获取和检测 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)
}