我创建了一个名为 PhobiaList.plist 的 .Plist。 我不确定我将如何实现 plist,以便在按下 button1 时它会显示随机进入 lable1?
最佳答案
假设您的 plist 中存储了一个数组。然后您可以生成一个介于 0 和 [theArray count]
之间的随机数。
NSInteger randomIndex = arc4random() % [theArray count];
通过调用选择字符串。
NSString* yourRandomString = [theArray objectAtIndex:randomIndex];
关于iphone - .Plist 数组生成随机字符串到 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9767142/