基本上我需要从 plist 中获取一个随机字母和与该字母相关的点。老实说,我不确定我是否以最好的方式设置了我的 plist,我以前从未使用过 plist:
一旦我得到这个工作,我将把 CZ 添加到 plist 中,每个字母关联点。我刚刚创建了一个基本的文字拼图游戏来尝试学习精灵套件。
到目前为止,我已经能够访问 plist 文件,但没有任何运气得到一个随机的信,它是积分。我尝试的一切都遇到了各种错误。
Here's my code so far to access the plist:
NSString* fileName = @"letters.plist";
NSString* filepath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fileName];
NSDictionary* lettersPlist = [NSDictionary dictionaryWithContentsOfFile:filepath];
NSDictionary* letters = lettersPlist[@"letters"];
那么我如何从这个 plist 中得到一个随机的字母和它的点呢?有没有更好的方法来做到这一点?