core data - Adding individual float values per UITableViewCell to get grand totals? -


i having major problem getting started finding answer question? have uitableview being populated user generated content , being persisted coredata. good. can't find way in apple docs following:

how add each dollar value in cell grand total displayed somewhere user? in case can thrown in uilabel in footer of each section don't care. can't figure out how each individual cell dollar amount entered there , add next dollar amount in next cell in section , on.

any ideas on how add totals cells grand total?

the elegant solution problem using key paths.

you not go cells , data out. go data model , calculate there. remember, mvc dictates should separate model , view.

suppose have subclass of nsmanagedobject nsnumber attribute "amount" fetched via core data. can simple calculations this:

float sum = [[fetchedobjects valueforkeypath:@"@sum.amount"] floatvalue]; 

this described in key-value coding programming guide under collection operators.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -