Basically i want is,Vertical
ABCDEFG....
which is located on right
sIDe of this image,when user clicks on characterM
i want to
get characterM
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联系人应用程序所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)