ios - NSMutableArray in NSMutableArray as a single object -
ios - NSMutableArray in NSMutableArray as a single object -
i trying add together nsmutablearray in nsmutablearray. trying nested arrays.
my current code is:
nsmutablearray *array1 = [nsmutablearray arraywithobjects: @"red", @"green", @"blue", @"yellow", nil]; nsmutablearray *array2 =[[nsmutablearray alloc] init]; [array2 addobject:array1];
this code adding 4 objects in array2 want add together array1 single object.
edit: code working know in case in xcode wrong initializing , adding 4 objects. still not figure out. piece of code working properly. problem initialization in loop.
i copy/pasted code, , adds 1 object array2, not four.
printing description of array2: <__nsarraym 0xc46c7b0>( <-- array has 1 object <__nsarraym 0xc488770>( <-- array has 4 objects red, green, blue, yellowish ) )
you may getting confused fact printing description, prints contents of inner array also.
ios xcode nsmutablearray
Comments
Post a Comment