iPhone – 索引像iOS联系人应用程序

iPhone – 索引像iOS联系人应用程序,第1张

概述我想创建一个像iOS联系人应用的视图, Basically i want is, Vertical ABCDEFG.... which is located on right side of this image, when user clicks on character M i want to get character M How should i achieve this ? is the 我想创建一个像iOS联系人应用的视图,

Basically i want is,Vertical ABCDEFG.... which is located on right
sIDe of this image,when user clicks on character M i want to
get character M How should i achIEve this ? is there any iOS
control which gives me this `ABCDEF…?

谢谢你的支持.

编辑

- (NSArray *)sectionIndexTitlesFortableVIEw:(UItableVIEw *)tableVIEw{    return [[NSArray arrayWithObject:UItableVIEwIndexSearch] arrayByAddingObjectsFromArray:            [[UILocalizedindexedCollation currentCollation] sectionIndexTitles]];}- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw sectionForSectionIndexTitle:(Nsstring *)Title atIndex:(NSInteger)index{    if (Title == UItableVIEwIndexSearch)    {        CGRect searchbarFrame = self.searchdisplayController.searchbar.frame;        [tableVIEw scrollRectToVisible:searchbarFrame animated:YES];        return -1;    }    else {        UILocalizedindexedCollation *currentCollation = [UILocalizedindexedCollation currentCollation];        NSLog(@"selected charecter=%ld",(long)[currentCollation sectionForSectionIndexTitleAtIndex:index]);        return [currentCollation sectionForSectionIndexTitleAtIndex:index-1];    }}
解决方法 您需要实现这两种方法:

// return List of section Titles to display in section index vIEw (e.g. "ABCD...Z#")- (NSArray *)sectionIndexTitlesFortableVIEw:(UItableVIEw *)tableVIEw;                                                    // tell table which section corresponds to section Title/index (e.g. "B",1))- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw sectionForSectionIndexTitle:(Nsstring *)Title atIndex:(NSInteger)index;

与相应的数据源:

例如,如果您有一个数组

`@"Cat",@"Mouse",@"Dog",@"Horse",@"Duck",@"Monkey"`

然后你将返回和sectionIndexTitlesFortableVIEw数组:

`@[@"C",@"D",@"H",@"M"]`

因为@“Dog”和@“Duck”代表@“D”,@“Mouse”和@“Monkey”代表@“M”,依此类推.

当然,对于sectionForSectionIndexTitle,您将返回该索引的相应索引. (1表示@“D”,3表示@“M”等)

总结

以上是内存溢出为你收集整理的iPhone – 索引像iOS联系人应用程序全部内容,希望文章能够帮你解决iPhone – 索引像iOS联系人应用程序所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1083630.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存