gpt4 book ai didi

iphone - TableView 从 NSDictionary 加载,但不是按字母顺序

转载 作者:行者123 更新时间:2023-12-01 19:28:53 26 4
gpt4 key购买 nike

我对编程很陌生,但现在正在尝试使用表格 View 应用程序。我为此使用了一些片段,但效果很好。我似乎无法弄清楚如何按字母顺序加载我的表格 View ,因为这样看起来好多了。导航有四个级别,前两个是 TableView 。所有数据都存储在带有字典的 plist 文件中。我包括了代码。我觉得我错过了一些非常明显的东西,但我似乎无法找出它是什么!谁能帮我?在此先感谢您的时间!

- (void)viewDidLoad {
// Create the table view data source array from the dictionary property
tableViewData = [[dataForCurrentLevel allKeys] retain];

最佳答案

请仔细阅读@VdesmedT 的回答。只需在将数组传递给 tableview 之前对数组进行排序,例如:

- (void)viewDidLoad {
// Create the table view data source array from the dictionary property
tableViewData = [[[dataForCurrentLevel allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] retain];

关于iphone - TableView 从 NSDictionary 加载,但不是按字母顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4544638/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com