Reputation: 1378
I want to create an array with the name the user has given as input in textfield, for this i want to know how to create an array dynamically.
Any help will be appreciated
Upvotes: 1
Views: 1019
Reputation: 2022
You can dynamically declare an array, but you can never use an input string as a name of your object's array.
Say what is you target, and we could help you to solve it. It looks like you want do do something and you are taking the wrong approach, if you have such request.
Upvotes: 0
Reputation: 17732
If you mean a dynamic variable name, then the only way you can sort of accomplish this is by creating the array and then storing it in a dictionary:
NSMutableDictionary *myArrays;//declared and initialized somewhere
NSMutableArray *newArray = [[NSMutableArray alloc] init];
[myArrays addObject:newArray forKey:someLabel.text];
Upvotes: 1