Instance Method


Asks the delegate whether a change in focus should occur.


- (BOOL)collectionView:(UICollectionView *)collectionView shouldUpdateFocusInContext:(UICollectionViewFocusUpdateContext *)context;



The collection view object requesting this information.


The context object containing metadata associated with the focus change. This object contains the index path of the previously focused item and the item targeted to receive focus next. Use this information to determine if the focus change should occur.

Return Value

YES if the focus change should occur or NO if it should not.


Before a focus change can occur, the focus engine asks all affected views if such a change should occur. In response, the collection view calls this method to give you the opportunity to allow or prevent the change. Return this method to prevent changes that should not occur. For example, you might use it to ensure that the navigation between cells occurs in a specific order.

If you do not implement this method, the collection view assumes a return value of YES.

If you subclass UICollectionView, you can also implement the same behavior by overriding the shouldUpdateFocusInContext: method, which is defined by the UIFocusEnvironment protocol and adopted by all views.

See Also

Managing Focus in a Collection View

- collectionView:canFocusItemAtIndexPath:

Asks the delegate whether the item at the specified index path can be focused.

- indexPathForPreferredFocusedViewInCollectionView:

Asks the delegate for the index path of the cell that should be focused.

- collectionView:didUpdateFocusInContext:withAnimationCoordinator:

Tells the delegate that a focus update occurred.