Różnica między NSArray i NSMutableArray
Jaka jest różnica b / w NSArray
i NSMutableArray
?
59
3 answers
NSMutableArray
(i wszystkie inne klasy z Mutable
w nazwie) mogą być modyfikowane. Tak więc, jeśli utworzysz zwykły NSArray
, nie możesz później zmienić jego zawartości (bez jej odtworzenia). Ale jeśli utworzysz NSMutableArray
, możesz go zmienić - zauważysz, że ma on metody takie jak -addObject:
i -insertObject:atIndex:
.
Zobaczdokumentację po szczegóły.
115
Author: jtbandes,
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
2012-04-18 07:55:47
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
2012-04-18 07:55:47
Typy "mutowalne" to klasy, które można zmienić po ich zainicjowaniu, np. NSMutableString
vs NSString
.
4
Author: Shaggy Frog,
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
2009-08-28 07:07:24
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
2009-08-28 07:07:24
NSArray: w NSArray nie możemy zmienić indeksu.... Oznacza fix array.
Nsmutablearray: w NSMutableArray możemy zmienić indeks, a także dodać wartość w tablicy w czasie wykonywania..
0
Author: Jagat Dave,
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
2016-01-01 05:07:59
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
2016-01-01 05:07:59