Cómo devolver un NSMutableArray desde un NSSet
Soy capaz de poner el contenido de un NSSet
en NSMutableArray
como esto:
NSMutableArray *array = [set allObjects];
El compilador se queja porque [set allObjects] devuelve un NSArray
no un NSMutableArray
. ¿Cómo debería arreglarse esto?
102
Author: Hemant Singh Rathore, 2010-09-30
3 answers
Dado que -allObjects
devuelve un array, puede crear una versión mutable con:
NSMutableArray *array = [NSMutableArray arrayWithArray:[set allObjects]];
O, alternativamente, si desea manejar la propiedad del objeto:
NSMutableArray *array = [[set allObjects] mutableCopy];
213
Author: dreamlax,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-09-30 00:41:50
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-09-30 00:41:50
Resolví el bloqueo usando el método de NSMutableArray 'addObjectsFromArray' para asignar todos los objetos NSSet a NSMutableArray como:
[mutableArray addObjectsFromArray:[cg_Schedule.schedule_Days allObjects]];
Espero que esto te ayude.
0
Author: Irfan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-21 07:12:17
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-21 07:12:17
Para un conjunto ordenado use:
NSArray *myArray = [[myOrderedSet array] mutableCopy];
-3
Author: Dustin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-17 06:07:19
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-17 06:07:19