I am building an app like Photos where you can scroll through thumbnails of your photos in a UICollectionView
and you can tap on one to view that photo full-screen. I'm working to add support for keyboard navigation so you can focus on a photo with the arrow keys then press space to view it full-screen, dismiss it, then focus on another photo. This works well in the Photos app, but in my app when you dismiss the full-screen view controller, the focus is not restored - that cell is not focused until you press an arrow key again. How do you restore the focus when the presented view controller is dismissed?
To enable focus I set these in the UICollectionViewController
:
collectionView.allowsFocus = true
collectionView.allowsFocusDuringEditing = true
collectionView.remembersLastFocusedIndexPath = true
I thought setting this would do the trick but I get the same behavior:
restoresFocusAfterTransition = true