iPhone UITableView.如何打开像音乐应用这样的单字母字母列表? [英] iPhone UITableView. How do turn on the single letter alphabetical list like the Music App?

查看:13
本文介绍了iPhone UITableView.如何打开像音乐应用这样的单字母字母列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iPhone 音乐应用程序中,选择艺术家、歌曲或专辑会在 UI 的右侧显示一个 tableView,其中包含单个字母的垂直列表,可以快速滚动.如何在我的应用中启用此功能?

In the iPhone music app, selecting Artist, Songs, or Albums presents a tableView with a verticl list of single letters at the righthand side of the UI that enables rapid scrolling. How do I enable this functionality in my app?

干杯,道格

推荐答案

提供您自己的索引字符:

Supply your own index characters:

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

您将需要部分.

这篇关于iPhone UITableView.如何打开像音乐应用这样的单字母字母列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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