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.
正如标题所说......我需要从数组(moodArray)中选择一个随机对象,我认为使用arc4random会更容易。如果您需要更多信息,请告诉我...提前致谢
id randomObject = [moodArray objectAtIndex:arc4random_uniform([moodArray count])];
NSString *myString = [moodArray objectAtIndex:arc4random()%[moodArray count]];