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

sebastijan

macrumors member
Original poster
May 22, 2005
62
2
London, UK
Hi. I have one question about Cocoa and Core Data.

How can I sum numbers in NSTableView and show them in NSTextField (and update any changes)? Like in this pic:

picture2qc7m.png
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
You are thinking about it the wrong way. You don't sum the numbers held in a view: views don't store numbers. You need to setup the controller layer to sum the data held in the model.

Assuming you are using bindings then you simply need to bind the content of the text field to the controller providing the data for the table using @sum.

This example shows how to do it with @count...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.