Konwersja NSArray do NSMutableArray [zamknięta]

Jak wyżej. Przydałoby się wiedzieć. Dzięki!

Author: Sidwyn Koh, 2010-07-11

3 answers

Oto dwie opcje:

- (NSMutableArray *)createMutableArray1:(NSArray *)array
{
    return [NSMutableArray arrayWithArray:array];
}

- (NSMutableArray *)createMutableArray2:(NSArray *)array
{
    return [[array mutableCopy] autorelease];
}
 73
Author: Cameron Spickert,
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
2011-09-02 18:26:10

Użyj -mutableCopy i upewnij się, aby zrównoważyć liczbę zatrzymanych.

NSMutableArray *mutableArray = [[immutableArray mutableCopy] autorelease];
 17
Author: Fabian Kreiser,
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-02-11 12:11:41

Spróbuj tego

NSMutableArray *array = [[NSMutableArray alloc]initWithArray:your_array_name];
 10
Author: dhaya,
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
2014-04-28 23:44:23