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.
在我的应用程序中,我让用户输入一个数字,然后一旦输入该数字,就会向屏幕上的分配空间发送响应。如何保存多个响应以随机生成到指定区域?
创建一个NSMutableArray并在那里添加数字。
NSMutableArray
NSMutableArray *array = [[NSMutableArray alloc] init]; //add the number [array addObject: number];
现在您可以从数组中随机选择数字并显示它们。
int number = [array objectAtIndex: 1];