Reputation: 1336
How can I make an array with "3 objects in one" what I want is something like this:
NSArray *array = [[NSArray alloc]initWithObjects:[UIImage , NSString , BOOL], [UIImage , NSString , BOOL], nil];
Is there some way to do this so that each object at index can have an image, string, and a boolean?
Upvotes: 3
Views: 124
Reputation: 31311
NSArray *array1 = [[NSArray alloc]initWithObjects:yourImage , YourString , yourStringBoolValue , nil];
NSArray *array2 = [[NSArray alloc]initWithObjects:array1 , nil];
Now array2
object 0
position contains all your objects as a collection.
To retrieve your values back,use the below code
NSArray *retriveArray1 = [array2 objectAtIndex:0];
UIImage *yourImage = [retriveArray1 objectAtIndex:0];
NSString *yourString = [retriveArray1 objectAtIndex:1]
BOOL yourBoolValue = [[retriveArray1 objectAtIndex:2] boolValue];
Upvotes: 6