Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios tableview中的索引和节问题_Ios_Objective C_List_Uitableview_Indexing - Fatal编程技术网

Ios tableview中的索引和节问题

Ios tableview中的索引和节问题,ios,objective-c,list,uitableview,indexing,Ios,Objective C,List,Uitableview,Indexing,我有一个tableview控制器。在表视图中,我有一个巨大的混乱名称列表。分区工作得很好,它根据名称的第一个字母对所有名称进行分组,但是表视图按照Xcode中编写的代码的顺序列出名称。下面是我使用的一段代码: SongsIndexTitles = @[@"A", @"B", @"C",@"Ç", @"D", @"E", @"F", @"G", @"H", @"I",@"İ", @"J", @"K", @"L", @"M", @"N", @"O", @"Ö", @"P", @"R", @"S",@

我有一个tableview控制器。在表视图中,我有一个巨大的混乱名称列表。分区工作得很好,它根据名称的第一个字母对所有名称进行分组,但是表视图按照Xcode中编写的代码的顺序列出名称。下面是我使用的一段代码:

SongsIndexTitles = @[@"A", @"B", @"C",@"Ç", @"D", @"E", @"F", @"G", @"H", @"I",@"İ", @"J", @"K", @"L", @"M", @"N", @"O", @"Ö", @"P", @"R", @"S",@"Ş", @"T", @"U",@"Ü", @"V", @"Y", @"Z"];


allTableData = [[NSArray alloc] initWithObjects:
                [[Songs alloc] initWithName:@"Aglarsa Anam Ağlar" andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Aynalı Kemer" andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Boşuna " andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Çöpçüler " andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Ahu Gozlum" andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Hepsi Senin mi?" andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Adin Ne" andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Pamuk" andDescription:@"Seslendiren: Abidin"],
                [[Songs alloc] initWithName:@"Sen Yoluna Ben Yoluma" andDescription:@"Seslendiren: Abidin "],
                [[Songs alloc] initWithName:@"Yolcu Yolunda Gerek" andDescription:@"Seslendiren: Abidin "],

它一直在继续。我需要做的是在“Aglarsa Anam Aglar”之前自动列出“Adin Ne”。正如我所说的,分段工作非常完美,但列表并没有什么好处


非常感谢您的帮助,谢谢您为什么不使用NSArray的Comparator对所有表格数据进行排序呢

使用
[string1比较:string2选项:NSNumericSearch]对其进行排序使用比较器的
分拣机内部块


然后将其用作表的数据源。

将数据添加到“Songs”数组后,对其进行排序。NSArray*SorterDarray=[歌曲SorterDarray使用selector:@selector(localizedCaseInsensitiveCompare:)];NSPredicates或sorting描述符很多?@samraankhan它给了我一个错误:选择器'sortedArrayUsingSelector'NSArray*sortedArray=[allTableData sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]没有已知的类方法;试试这个。这是我尝试的第一件事,它给出了一个警告:未使用的变量'sortedArray',当我运行sim卡时,它会压碎应用程序。还有一件事,我应该把这段代码放在哪里?