Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create array of single ivar from array objects with multiple ivars

Tags:

objective-c

if i have an class with two properties "a" and "b" and i have an array of these class instances. What is the best way to create an array of only only "a" elements.

like image 622
prostock Avatar asked Aug 16 '26 01:08

prostock


1 Answers

The simplest way is Key-Value Coding:

[yourArray valueForKey:@"a"];
like image 159
Chuck Avatar answered Aug 17 '26 15:08

Chuck