I have a class called Body. In this class I have 3 int variables for weight, height, age. In main.m I instantiate Body *personOne and then use arc4Random to auto fill in the 3 ivars (not worried about floats, it's all integers)
That part I have down just fine, but I want to create something like 20 people and store them in an NSMUtableArray. My hopes are to use a for loop to auto create 20 people with different stats for the 3 ivars and then add them to an an NSMutableArray so I can adjust weight, age and so on.
I know that NSMutableArrays can only store objects and not Integers. But what if integers are embedded in personOne which is an object then you are storing the personOne object in an NSMutableArray, right? Or must they all be converted to NSNumber to store that way?
I have been scratching my head most of the night trying to figure out how to create 20 persons objects with a for loop, add the 3 values and store them into an NSMutableArray.
Is this possible, Body *person = [[Body alloc] init]; for creating 20 persons and incrementing i within a for loop?
Thanks
That part I have down just fine, but I want to create something like 20 people and store them in an NSMUtableArray. My hopes are to use a for loop to auto create 20 people with different stats for the 3 ivars and then add them to an an NSMutableArray so I can adjust weight, age and so on.
I know that NSMutableArrays can only store objects and not Integers. But what if integers are embedded in personOne which is an object then you are storing the personOne object in an NSMutableArray, right? Or must they all be converted to NSNumber to store that way?
I have been scratching my head most of the night trying to figure out how to create 20 persons objects with a for loop, add the 3 values and store them into an NSMutableArray.
Is this possible, Body *person = [[Body alloc] init]; for creating 20 persons and incrementing i within a for loop?
Thanks