【问题标题】:Display the array sequence from arrays of arrays显示数组数组中的数组序列
【发布时间】:2014-05-09 03:29:31
【问题描述】:

我一直无法从 NSDictionaries 的 NSMutableArray 中获取数组序列。

我正在尝试让表格视图显示插入到 NSMutableArray 中的 NSDictionary 位置。

NSMutableArray 包含

NSDictionary1 contains NSString(Fabian), NSString(Toulouse), NSData(JPGFILE)
NSDictionary2 contains NSString(Kindle), NSString(May)     , NSData(PNGFILE)
NSDictionary3 contains NSString(Far)   , NSString(Ney)     , NSData(JPGFIle)

要显示的表格视图

S/no    First Name    Last Name       Image
 1        Fabian       Toulouse       JPGFILE   
 2        Kindle       May            PNGFILE
 3        Far          Ney            JPGFIle

我想根据插入顺序显示“S/​​no”。

帮助!大师!

【问题讨论】:

  • 卡住是什么意思?你看到了什么奇怪的结果?
  • 我的意思是我无法根据数组的索引显示 S/No。我有 [self.personsArray 计数]。它只显示 NSMutableArray 中 NSDictionary 的总数
  • 等等。我想我明白了。

标签: ios objective-c


【解决方案1】:

为此,请考虑使用 [self.NSMutableArrayName indexOfObject: NSDictionary];

因为它会返回一个从 0 开始的数字,所以你需要加 1。

1 + [self.NSMutableArrayName indexOfObject: NSDictionary];

【讨论】:

    【解决方案2】:

    你可以得到对象的索引请看这个帖子

    http://stackoverflow.com/questions/19647329/ios-how-to-find-insertion-position-in-sorted-nsmutablearray
    

    [myArray indexOfObject:newDict];
    

    谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-23
      • 1970-01-01
      • 2019-08-20
      • 1970-01-01
      • 2014-07-29
      • 1970-01-01
      • 2023-03-10
      • 2016-01-28
      相关资源
      最近更新 更多