2015-11-25 67 views
0

我怎樣才能得到和檢測項目的indexPath聚焦在這個代碼collectionView或?TVOS,檢測indexPath焦點更新

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

回答

3

使用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) 
}