List 表视图的索引列表显示dot iOS 5+;
在我的应用程序中,我在带有索引列表的表视图中显示联系人。我正在显示索引列表,如下所示:List 表视图的索引列表显示dot iOS 5+;,list,uitableview,ios5,indexed,List,Uitableview,Ios5,Indexed,在我的应用程序中,我在带有索引列表的表视图中显示联系人。我正在显示索引列表,如下所示: static NSString *letters = @"abcdefghijklmnopqrstuvwxyz#"; -(void)getAllUserInfoUsingBlock:(lclResultsArray) block { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
static NSString *letters = @"abcdefghijklmnopqrstuvwxyz#";
-(void)getAllUserInfoUsingBlock:(lclResultsArray) block
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
NSMutableArray *allUserInfoArray = [[NSMutableArray alloc]init];
NSLog(@"[letters length]:- %d",[letters length]);
for (int i = 0; i < [letters length]; i++ ) {
NSMutableDictionary *row = [[NSMutableDictionary alloc] init];
char currentLetter[2] = { toupper([letters characterAtIndex:i]), '\0'};
NSString *str=[NSString stringWithCString:currentLetter encoding:NSASCIIStringEncoding];
NSMutableArray *words = nil;
NSLog(@"Value of i:- %d:: Letter:- %@",i,str);
if (i<[letters length]) {
words = [self getUserInfoByStartingCharOfLastName:str isForEmptyValue:NO];
}
else {
// Get users where name is empty
words = [self getUserInfoByStartingCharOfLastName:@"" isForEmptyValue:YES];
}
NSLog(@"Count for %@ :- %d",str,words.count);
[row setValue:str forKey:@"sectionTitle"];
[row setValue:words forKey:@"sectionRows"];
[allUserInfoArray addObject:row];
}
dispatch_async(dispatch_get_main_queue(), ^{
for (NSDictionary *dict in allUserInfoArray) {
NSLog(@"Array count:- %d",[[dict objectForKey:@"sectionRows"]count]);
}
block(allUserInfoArray,nil);
});
});
}
- (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section
{
if (aTableView != self.searchDisplayController.searchResultsTableView){
NSMutableDictionary *sections=[self.contactsArray objectAtIndex:section];
NSString * sectionTitle= [sections objectForKey:@"sectionTitle"];
return sectionTitle;
}
return nil;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
if (tableView != self.searchDisplayController.searchResultsTableView){
NSMutableDictionary *sections=[self.contactsArray objectAtIndex:index];
NSString * sectionTitle= [sections objectForKey:@"sectionTitle"];
return [self.indices indexOfObject:sectionTitle];
}
return 0;
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
if (tableView != self.searchDisplayController.searchResultsTableView){
return [self.contactsArray valueForKey:@"sectionTitle"];
}
return nil;
}
static NSString*字母=@“abcdefghijklmnopqrstuvwxyz”;
-(无效)GetAllUserInformation块:(lclResultsArray)块
{
调度异步(调度获取全局队列(调度队列优先级高,0)^{
NSMutableArray*AllUserInfo数组=[[NSMutableArray alloc]init];
NSLog(@“[字母长度]:-%d”,[字母长度];
对于(int i=0;i<[字母长度];i++){
NSMutableDictionary*行=[[NSMutableDictionary alloc]init];
字符currentLetter[2]={toupper([letters characterAtIndex:i]),'\0'};
NSString*str=[NSString stringWithCString:currentLetter encoding:NSASCISTRINGEncoding];
NSMutableArray*字=nil;
NSLog(@“i:-%d的值::字母:-%@”,i,str);
如果(i索引列表中字符之间的替换点取决于索引列表的显示高度。如果我们可以增加表的大小,它将自动显示整个字符。谢谢。增加高度后,它将显示所有索引列表。如果我不能在视图中增加表的高度怎么办?如何滚动索引列表表视图右侧的harachters?有人对此有答案吗?点是有意的,就像文本中的省略号(…),当没有足够的空间显示列表中的每一项时,允许显示整个索引列表(“A”在顶部,而“#”在底部)。表滚动,索引列表不滚动。“这不是一个bug,而是一个特性。”:-)