Monday, 9 September 2013

Naming class instances in a "for" loop (cocoa)

Naming class instances in a "for" loop (cocoa)

I would like to instantiate some custom objects in a for loop retrieving
them from an array. I also would like to give the pointer the name of an
array's value. (Example)
personArray in generalArray value: 0=name , 1=address, 2=mobile…
Object: Person (with the instante variables of the personArray)
////////
for (NSArray*person in generalArray){
NSString*name=[[NSString alloc] initWithString:[person ObjectAtIndex:0];
NSString*address=[[NSString alloc] initWithString:[person
ObjectAtIndex:1]; …
//Now I want to instantiate objects "person" with "name, address…"
variables. I also tried to name pointers with the "name" NSString.
}
Are there any solutions?

No comments:

Post a Comment