【问题标题】:Indexed table from array of strings iOS来自字符串数组的索引表iOS
【发布时间】:2012-08-09 10:58:15
【问题描述】:

我有字符串数组

 NSMutableArray * nam = [[NSMutableArray alloc] initWithObjects:@"ZAZ", @"London", @"Australia",@"England", @"Dallas", @"Mexico", @"Russia", nil]; 

我怎样才能从这个字符串按字母顺序创建索引的TableView???就像在“通讯录”中一样!或者也许有人知道这个问题的一些教训?

【问题讨论】:

  • 您可以先按字母顺序对数组进行排序,然后在表格视图中使用该排序后的数组..

标签: iphone objective-c ios uitableview ios4


【解决方案1】:

编辑:创建UITableView 跟随链接。使用 newArray 作为 tableview 数组

像这样按字母顺序对 NSMutableArray 进行排序:

NSMutableArray *newArray = [nam sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

将此 newArray 用作 TableViewDataSource 数组用于按字母顺序排列的单元格

【讨论】:

  • 好的。以及如何添加索引?以及如何通过单击索引表跳转到部分来做到这一点???
  • iphonesdkarticles.com/2009/01/…带索引表的简单项目)
猜你喜欢
  • 2015-11-05
  • 1970-01-01
  • 2019-05-19
  • 2012-07-20
  • 2019-04-14
  • 2015-03-03
  • 2014-11-25
  • 1970-01-01
  • 2020-03-06
相关资源
最近更新 更多