focusedCellIndexPath on UICollectionView should be public

Originator:Josh.Lieberman92
Number:rdar://34983799 Date Originated:October 13 2017
Status:Closed Resolved:
Product:tvOS + SDK Product Version:
Classification:Suggestion Reproducible:
 
Area:
tvOS SDK

On tvOS, UICollectionView offers no interface to programmatically focus a specific cell or index path.  There should be an interface to explicitly set the focused index path, or the _focusedCellIndexPath property on UICollectionView should be public.

Comments

Apple Developer Relations - November 10 2017, 1:33 PM

You can call setNeedsFocusUpdate to trigger a focus update which should result in another call to the indexPathForPreferredFocusedViewInCollectionView: delegate method.

By Josh.Lieberman92 at Nov. 10, 2017, 7:44 p.m. (reply...)

Joshua Lieberman - October 17 2017, 12:49 PM

I don't find this to be a scalable solution. The indexPathForPreferredFocusedViewInCollectionView: delegate method is only called once, when the collection view first becomes focused, and only if remembersLastFocusedIndexPath is set to YES. There should be a way to arbitrarily reset the currently focused index path. An example use case is when a collection view has remembersLastFocusedIndexPath set to YES, a reload occurs, and the originally remembered index path is not available (due to change in data, etc). In this case, we want to select the item at index path (0, 0), which we cannot currently do with indexPathForPreferredFocusedViewInCollectionView:.

By Josh.Lieberman92 at Nov. 10, 2017, 7:44 p.m. (reply...)

Apple Developer Relations - October 16 2017, 7:27 PM

The indexPathForPreferredFocusedViewInCollectionView: delegate method should be used for this purpose.

By Josh.Lieberman92 at Nov. 10, 2017, 7:44 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!