Create a NSDictionary and use the string as key, and array as value.
Create arrays with different Names [closed]
-
23-09-2022 - |
Pregunta
i want to create arrays with different *names (the text out of a textField should be the name of the array) when an IBAction
function is called. How do i get the text out of the text field and make it the *name of the array?
- (IBAction)createButton:(id)sender {
NSMutableString *string = [[NSMutableString alloc] init];
[string setString:[textField text]];
NSMutableArray *string = [[NSMutableArray alloc] init];
}
Solución
Otros consejos
try this . . .
- (IBAction)createButton:(id)sender {
NSString *string = [textField text];
NSMutableArray *array = [string componentsSeparatedByString:@" "];
}
if names are separated by space , then provide space , if they are separated by comma ',' then
// NSMutableArray *array = [string componentsSeparatedByString:@","];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow