iPhone UITableView. How do turn on the single letter alphabetical list like the Music App?

后端 未结 9 903
再見小時候
再見小時候 2020-12-02 04:25

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 scr

9条回答
  •  离开以前
    2020-12-02 05:01

    If you're using a NSFetchedResultsController, you can just do:

    - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
        return [frc sectionIndexTitles];
    }
    
    - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
        return [frc sectionForSectionIndexTitle:title atIndex:index];
    }
    

提交回复
热议问题