Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在 iPhone 上开发一款游戏,我使用 Chipmunk 库来生成环境。所以我面临的问题是我正在从文件中调用障碍物的坐标。
我想要一些反馈,了解我以 XML 或普通文本文件的形式存储每个级别的障碍物坐标的最佳方式是什么。
我认为最好的方法是使用一个.plist文件(当然是 XML),然后使用NSArray * cArray = [NSArray arrayWithContentsOfFile:plistPath]
.plist
NSArray * cArray = [NSArray arrayWithContentsOfFile:plistPath]
我也会选择 plist - 它简单易行。如果你想要更多与代码相关的东西,你可以选择 NSKeyedArchiver。只需确保您要序列化的所有类都符合 NSCoding 标准。