Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

oli364

macrumors newbie
Original poster
Sep 11, 2010
1
0
I have (for example) a table with cars in. The cars each have a name, a color and a mileage.

I can have a text field which displays the total mileage of all the cars using bindings in interface builder:

Value - Bind To: Car Array Controller.arrangedObjects.@sum.mielage

However, I would like separate boxes for the total mileage done by red cars and blues cars. I know i can code this using a predicate to filter the array eg:

Code:
NSPredicate *bluePredicate = [NSPredicate predicateWithFormat:@"color like blue"];

NSArray *blueCars = [[carArrayController arrangedObjects] filteredArrayUsingPredicate:bluePredicate];

NSNumber *blueMileage = [blueFilteredArray valueForKeyPath:@"@sum.mileage"];


But I don't want to have to do this and have to code IBOutlets for the text boxes. I want to do it purely in IB if possible.

Any ideas??

Cheers, Oli
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.