gpt4 book ai didi

ios - pList IOS Swift 中的数据是无序的

转载 作者:行者123 更新时间:2023-11-28 08:51:58 24 4
gpt4 key购买 nike

我正在制作一个应用程序,其中我通过获取 Plist 字典来填充数组,并在表格 View 中显示。一切正常,但数据并不像我们在 plist 中写入的那样有序。

异常(exception):

1-A

2-B

3-C

但在运行时执行时,实际结果是这样的。

1-C

2-A

3-B

我正在使用 Swift,但在 Internet 上找不到任何有用的帮助,因为我真的不知道实际上要写什么才能找到帮助。

所以请尽量提供任何有用的信息来避免这个问题。我可以按需提供代码。

编辑:

请检查我的 Plist 结构的图像 enter image description here

最佳答案

像这样制作一个plist文件

enter image description here

然后获取数组并循环

    let path = NSBundle.mainBundle().pathForResource("test", ofType:"plist")
let array = NSArray(contentsOfFile: path!) as! [Dictionary<String, String>]

for dic in array {
let value = dic["someKey"]
}

关于ios - pList IOS Swift 中的数据是无序的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33992759/

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