Der BDKCollectionIndexView wäre eine großartige Lösung für Ihr Problem.
https://github.com/kreeger/BDKCollectionIndexView
Diese im Grunde eine ähnliche Indizierung UI zu dem dem UITableView erstellen.
Dies ist ein Beispielcode, der vom Ersteller veröffentlicht wurde.
override func viewDidLoad() {
super.viewDidLoad()
let indexWidth = 28
let frame = CGRect(x: collectionView.frame.size.width - indexWidth,
y: collectionView.frame.size.height,
width: indexWidth,
height: collectionView.frame.size.height)
var indexView = BDKCollectionIndexView(frame: frame, indexTitles: nil)
indexView.autoresizingMask = .FlexibleHeight | .FlexibleLeftMargin
indexView.addTarget(self, action: "indexViewValueChanged:", forControlEvents: .ValueChanged)
view.addSubview(indexView)
}
func indexViewValueChanged(sender: BDKCollectionIndexView) {
let path = NSIndexPath(forItem: 0, inSection: sender.currentIndex)
collectionView.scrollToItemAtIndexPath(path, atScrollPosition: .Top, animated: false)
// If you're using a collection view, bump the y-offset by a certain number of points
// because it won't otherwise account for any section headers you may have.
collectionView.contentOffset = CGPoint(x: collectionView.contentOffset.x,
y: collectionView.contentOffset.y - 45.0)
}
Diese Frage ist auch eine mögliche doppelte: SectionIndexTitles for a UICollectionView