开发者

How to get the alphabetical list beside the tableview

based on the alphabetical selection i can display data in UITableView.

my searching capability will reduces the wit开发者_开发技巧h the help of alphabetical selections

Any example links. please help me out.


I found this tutorial to be useful. It contains the code as well as explanations:

http://www.iphonedevcentral.com/indexed-uitableview-tutorial/

As a quick summary, the gist is that you need to implement two methods:

-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    //The array of strings to use as indices
}

-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
    //The index (integer) of the current section that the user is touching
}


You can sort the array by using this code.

sortedArray = [yourArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

checkout the apple's Documentation for more details


You can use segmented table withsorted array, if you want segementation according to alphabate. and to full fill the requirnment of sorted data display.. you only need to sort the source of data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜