Count number of items in NSArray with certain property (iPhone Programming)
<p>I have an NSArray that looks like this:</p>

<pre><code>ArrayItem *thisone = [[ArrayItem alloc] initWithName:@"The Name" data1:@"Some data" data2:@"Some more data" image:@"theimage.jpg" range:0];

ArrayItem *thisone1 = [[ArrayItem alloc] initWithName:@"The Name" data1:@"Some data" data2:@"Some more data" image:@"theimage.jpg" range:0];

ArrayItem *thisoneagain = [[ArrayItem alloc] initWithName:@"The Name 2" data1:@"Some data2" data2:@"Some more data2" image:@"theimage2.jpg" range:1];

ArrayItem *thisoneagain1 = [[ArrayItem alloc] initWithName:@"The Name 2" data1:@"Some data2" data2:@"Some more data2" image:@"theimage2.jpg" range:1];

ArrayItem *thisoneagain2 = [[ArrayItem alloc] initWithName:@"The Name 2" data1:@"Some data2" data2:@"Some more data2" image:@"theimage2.jpg" range:1];

ArrayItem *thisoneyetagain = [[ArrayItem alloc] initWithName:@"The Name 3" data1:@"Some data3" data2:@"Some more data3" image:@"theimage3.jpg" range:2];

ArrayItem *thisoneyetagain1 = [[ArrayItem alloc] initWithName:@"The Name 3" data1:@"Some data3" data2:@"Some more data3" image:@"theimage3.jpg" range:2];

ArrayItem *thisoneyetagain2 = [[ArrayItem alloc] initWithName:@"The Name 3" data1:@"Some data3" data2:@"Some more data3" image:@"theimage3.jpg" range:2];

ArrayItem *thisoneyetagain3 = [[ArrayItem alloc] initWithName:@"The Name 3" data1:@"Some data3" data2:@"Some more data3" image:@"theimage3.jpg" range:2];

self.ArrayItems = [[NSMutableArray alloc] initWithObjects:thisone,thisone1,thisoneagain,thisoneagain1,thisoneagain2,thisoneyetagain,thisoneyetagain1,thisoneyetagain2,thisoneyetagain3,nil];
</code></pre>

<p>and I would like to count the number of items in each "range" (as in there are 2 items with a range of 0, 3 with a range of 1, and 4 with a range of 2) and store the number of items for each range in separate variables. Any idea how to do this? ArrayItems.count just tells me how many there are in total.</p>
