9

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.

- (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.

aheze
  • 24,434
  • 8
  • 68
  • 125
ShujatAli
  • 1,376
  • 2
  • 14
  • 26
  • Try to use a sort selector. This question might help you. http://stackoverflow.com/questions/1351182/how-to-sort-a-nsarray-alphabetically – Maurice Jun 23 '14 at 12:32
  • i dont want to sort , as i mentioned ; i already impleneted sort functionality – ShujatAli Jun 23 '14 at 12:39
  • possible duplicate of [SectionIndexTitles for a UICollectionView](http://stackoverflow.com/questions/13882052/sectionindextitles-for-a-uicollectionview) – jszumski Apr 20 '15 at 17:19

1 Answers1

1

BDKCollectionIndexView implements a UITableView-like section index bar. It's pretty easy to integrate once you have it positioned onscreen: just assign an array of NSStrings from your datasource:

self.indexView.indexTitles = self.fetchResultsController.sectionIndexTitles;
jszumski
  • 7,430
  • 11
  • 40
  • 53