Post

Replies

Boosts

Views

Activity

How to initially enable focus in a collection view programmatically?
Hi I've set up a list UICollectionView with focus (without selectionFollowsFocus as I must distinguish between focus and selection by tap) Everything is working correctly, except I'm trying to setup the first cell as focused on startup, without the user having to use tab/down key initially. I've tried: calling setNeedsFocusUpdate() and updateFocusIfNeeded() setting 1st cell in preferredFocusEnvironments and indexPathForPreferredFocusedView setting focusGroupPriority to different values (even Int.max) directly on the cell But initial focus is not set. Enabling focus loop debugger correctly shows the 1st cell as the 'next' focused element, but I cannot figure out how to actually trigger it without external keyboard. Thanks
1
0
1.3k
Sep ’21