As the question, I'm trying to add an "index titles" in a collection view for a fast navigation of the contents of my UIColletionView
.
I've read that, starting from iOS 10, method like indexTitles(for:)
and collectionView(_:indexPathForIndexTitle:at:)
can help me in that as in the UITableViews. But I'm not getting any result! Have you figured out how to use those methods? Thanks in advance for any help.
If you look at UICollectionView.h
, indexTitlesForCollectionView
is only available in tvos:
/// Returns a list of index titles to display in the index view (e.g. ["A", "B", "C" ... "Z", "#"])
- (nullable NSArray<NSString *> *)indexTitlesForCollectionView:(UICollectionView *)collectionView API_AVAILABLE(tvos(10.2));
You might have read Apple's documentation, which states that indexTitle methods are available for iOS 10.3+ and tvOS 10.2+: https://developer.apple.com/documentation/uikit/uicollectionviewdatasource/2851455-indextitles
I tried implementing it on iOS and it just doesn't work, which leads me to believe that somehow they made a mistake in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With