[英]iOS alphabetical scroll for UICollectionView
I have a collection view which shows multiple images of peoples and their names, and I have implemented search and sorting functionality.我有一个集合视图,它显示了多个人及其姓名的图像,并且我已经实现了搜索和排序功能。 However, the problem is I want alphabetical also, but the collection view does not have delegate methods like UITableView
has.但是,问题是我也想要按字母顺序排列,但是集合视图没有像UITableView
那样的委托方法。
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
return[NSArray arrayWithObjects:@"a", @"e", @"i", @"m", @"p", nil];
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString
*)title atIndex:(NSInteger)index {
return <yourSectionIndexForTheSectionForSectionIndexTitle >;
}
I had tried this question also, but this shows collection view cells in a section.我也试过这个问题,但这显示了一个部分中的集合视图单元格。 I don't want multiple sections.我不想要多个部分。 I want only section and implement alphabetical scroll functionality it.我只想要部分并实现按字母顺序滚动的功能。
Above methods are not in UICollectionViewDelegate
methods.以上方法不在UICollectionViewDelegate
方法中。
BDKCollectionIndexView
implements a UITableView
-like section index bar. BDKCollectionIndexView
实现了一个类似UITableView
的部分索引栏。 It's pretty easy to integrate once you have it positioned onscreen: just assign an array of NSString
s from your datasource:一旦你将它定位在屏幕上,它就很容易集成:只需从你的数据源分配一个NSString
数组:
self.indexView.indexTitles = self.fetchResultsController.sectionIndexTitles;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.