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

查看:177
本文介绍了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?

干杯,
Doug

Cheers, Doug

推荐答案

提供您自己的索引字符:

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天全站免登陆