Jak zwrócić NSMutableArray z NSSet
Jestem w stanie umieścić zawartość NSSet
w NSMutableArray
Tak:
NSMutableArray *array = [set allObjects];
Kompilator narzeka, ponieważ [set allObjects] zwraca NSArray
, a nie NSMutableArray
. Jak należy to naprawić?
102
Author: Hemant Singh Rathore, 2010-09-30
3 answers
Ponieważ -allObjects
zwraca tablicę, możesz utworzyć zmienną wersję za pomocą:
NSMutableArray *array = [NSMutableArray arrayWithArray:[set allObjects]];
Lub, alternatywnie, jeśli chcesz obsłużyć własność obiektu:
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/doraprojects.net/template/agent.layouts/content.php on line 54
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/doraprojects.net/template/agent.layouts/content.php on line 54
2010-09-30 00:41:50
Rozwiązałem awarię używając nsmutablearray 'S metoda 'addObjectsFromArray' aby przypisać wszystkie nsset obiekty do NSMutableArray Jak:
[mutableArray addObjectsFromArray:[cg_Schedule.schedule_Days allObjects]];
Mam nadzieję, że to ci pomoże. 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/doraprojects.net/template/agent.layouts/content.php on line 54
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/doraprojects.net/template/agent.layouts/content.php on line 54
2015-04-21 07:12:17
Do użycia zestawu uporządkowanego:
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/doraprojects.net/template/agent.layouts/content.php on line 54
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/doraprojects.net/template/agent.layouts/content.php on line 54
2013-09-17 06:07:19