用于uicollectionview的IOS字母滚动 [英] IOS alphabetical scroll for uicollectionview

查看:460
本文介绍了用于uicollectionview的IOS字母滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个收集视图,显示了人们及其名字的多个图像,我已经实现了搜索和排序功能,但问题是我也想按字母顺序排列。但是它的collectionview没有像table这样的委托方法。

I had a collectionview which shows multiple images of peoples and their names , i had implemented search and sorting functionality , but problem is i want alphabetical also . but it collectionview does not have delegate methods like table 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 >;
}

我试过这个问题也是,但这显示了一个部分中的collectionview单元格。但问题是我不想要多个部分。我只想要部分和实现字母滚动功能,请指导我一些帮助

i had tried this question also , but this shows collectionview cells in a section. but problem is i dont want multiple sections. i want only section and implement alphabetical scroll functionality it , please guide me some help

上面的方法不在collectionviewdelegate方法中。

above methods are not in collectionviewdelegate methods.

推荐答案

BDKCollectionIndexView 实现 UITableView -like部分索引栏。一旦将它放在屏幕上,它就很容易集成:只需从数据源中分配一个 NSString 的数组:

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;

这篇关于用于uicollectionview的IOS字母滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆