objective c - Create NSMutableArray by a NSString value -
how can create nsmutablearray (name) dynamically nsstring value?
e.g. nsstring *stringname = @"helloarray1";
then create nsmutablearray "helloarray1" dynamically.
e.g. nsmutablearray * (--here stringname / helloarray1---) = [nsmutablearray new];
and nslog:
nslog(@"%@", (--here stringname / helloarray1---) );
thanks help
i think that's not possible.
better set dynamically object. example:
nsmutabledictionary *variables = [nsmutabledictionary new]; (int = 0; < 10; i++) { nsmutablearray *temp = [[nsmutablearray alloc] initwithobjects:@"1", @"2", nil]; [variables setobject:temp forkey:[nsstring stringwithformat:@"value_%d", i]]; } nslog(@"%@", [variables objectforkey:@"value_1"]);
Comments
Post a Comment