ios uitableview section index

how can I made my section index different from my section titles?

For example, lets say I have letters of cities in my section titles (A,B,C, etc) but I also want to add one to the top called 'Recent Cities'. Now in the section index I dont want to show Recent Cities but something different like Rec or Re.

Is there some kind of override for this? Maybe it is simpler than I think?

Answers


Just implement UITableViewDataSource method like this

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{
    return [NSArray arrayWithObjects:@"Rec", @"A", @"B", nil ];
}

As beryllium said, this should be done in the sectionIndexTitlesForTableView: method as part of the data source implementation.


Need Your Help

Fetching data using Core Data

objective-c ios core-data nspredicate nsfetchrequest

I have searched quite a lot on the internet but can't find what I'm looking for.

Android 4.3 keychain example

android keychain android-4.3-jelly-bean

I am trying to understand the keychain concept in android 4.3 and I will really appreciate it if I can get a example to understand it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.