0
A
回答
2
這是一個非常寬泛的問題,但這裏是一個非常簡單的答案。
要保存數組到文件:
[NSKeyedArchiver archiveRootObject:array toFile:fileName];
若要從文件加載數組:
NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithFile:fileName];
這些調用依賴於NSArray的實現NSCoding(通過NSSecureCoding)的事實。
相關問題
- 1. 保存並加載Int數組
- 2. 數組保存到文件目標C
- 3. 並保存到數組C++
- 4. 將自定義對象的數組保存/加載到plist目標C
- 5. C#設置加載並保存
- 6. 加載並保存文件在Unity,C#
- 7. 保存並加載菜單狀態c#
- 8. 檢查並保存/加載MySQL C#
- 9. 保存並加載圖像SQLite C#
- 10. 保存並加載C++程序
- 11. C# - 保存DataGridView文件並加載
- 12. 加載並保存列表
- 13. C#:保存並從app.config文件加載組合框項目列表
- 14. GamePlayKit GKObstacleGraph保存並加載
- 15. 保存並加載高分
- 16. AutoCompleteCustomSource保存並加載
- 17. C#永久性添加並保存項目到組合框
- 18. C++控制檯保存並加載保存的「遊戲」
- 19. 從plist文件保存/加載數組
- 20. 將數據保存並加載到xml
- 21. 加載/編輯並保存XML數據
- 22. Anglesharp IElement保存並加載
- 23. 保存並加載從jPBC
- 24. 保存並加載GUI-tkinter
- 25. MFC。保存並加載CMFCRibbonRichEditCtrl
- 26. 保存並加載UIImageView
- 27. 保存並加載FlannBasedMatcher
- 28. numpy保存/加載損壞數組
- 29. VB.NET:保存並加載數據?
- 30. 快速加載/保存多維數組
您可以作爲[屬性列表]進行讀取/寫入(https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/PropertyLists/ReadWritePlistData/ReadWritePlistData.html#//apple_ref/doc/uid/10000048i-CH8-SW1),或者您可以讀/寫爲[JSON](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html)。 –