ios - iPhone UITableView。如何开启音乐 App 之类的单字母字母列表?

标签 ios iphone objective-c uitableview

在 iPhone 音乐应用中,选择 Artist、Songs 或 Albums 会在 UI 右侧显示一个 tableView,其中包含单个字母的垂直列表,可以快速滚动。如何在我的应用中启用此功能?

干杯, 道格

最佳答案

提供您自己的索引字符:

- (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 >;
}

您将需要部分。

关于ios - iPhone UITableView。如何开启音乐 App 之类的单字母字母列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1655119/

相关文章:

ios - 如何使用 Swift 在 iOS 中防止视频放大/缩小?

iphone - Obj-C 的 ZXing 无法编译

ios - 在 Xcode 中验证资源并为 iOS 应用程序生成 getter 代码

ios - 临时分发 : failed to install app

ios - 有什么方法可以使 UISegmentedControl 中的段宽度与内容成正比?

ios - 在 iOS 6 中将委托(delegate)设置为 nil

ios - 保留添加到 ScrollView 的 subview 的大小

iphone - 有什么办法可以在iOS6下开发针对iOS 3.1.2的iPhone应用程序?

objective-c - 从停靠栏隐藏应用程序图标,但在任务切换器中保留图标?

objective-c - 大数据集的 Swift 数据初始化缓慢且内存效率低下