5

I have a model which is essentially three entities: Manufacturers <---->> Models <---->> Cars

The Manufacturer entity has property 'name'

The Model entity has property 'name'

The Car entity has properties 'registration' and 'milage'

I have a table view which displays on a each row a cars registration, milage, model and manufacturer, easily bound by eg:

Bind To: Cars, Controller Key: arrangedObjects, Model Key Path: model.manufaturer.name

I have another table view where I want to display the manufacturers and the total milage done by all their cars.

So the first column I have bound as:

Bind To: Manufacturers, Controller Key: arrangedObjects, Model Key Path: name

My problem occurs when then trying to bind the total milage. I have tried accessing it by:

Bind To: Manufacturers, Controller Key: arrangedObjects, Model Key Path: models.cars.@sum.milage

But this doesn't seem to work :( Am I going about this in completely the wrong way? Or do I need to add some methods to my Manufacturer, Model or Car classes?

Many thanks

EDIT: More info

Curiously binding a separate table to

Model - arrangedObjects - name
Model - arrangedObjects - cars.@sum.milage

Works, although an error is still thrown in the log: [<_NSFaultingMutableSet 0x1dbbb0> addObserver:forKeyPath:options:context:] is not supported. Key path: @sum.milage

Quantum_Oli
  • 267
  • 2
  • 10

0 Answers0