开发者

Core Data calculation result at startup

开发者 https://www.devze.com 2022-12-19 18:40 出处:网络
Thanks for the help. I have a doc based Core Data app consisting of a table with two columns. The column cells are populated with US Currency dollar values. I have two labels at the bottom of each co

Thanks for the help.

I have a doc based Core Data app consisting of a table with two columns. The column cells are populated with US Currency dollar values. I have two labels at the bottom of each column with Number formatters. Each label displays the sum of it's respective column. I'm doing this with bindings:

  • Bound to the arrayControlle开发者_如何学编程r
  • Controller Key - arrangedObjects
  • modelKey - @sum.regAmount, @sum.regAmount1

The label attribute Types are int 16 in the data model.

Anyway, these calculations work fine, and the resulting values are displayed at startup.

What I need to do is also display the difference between the two resulting sums at startup in a third label. For some reason I can't pick up the sum values to preform the calculation.

This action works using a sender:

(runningBalance.intValue = (theDeposits.intValue - theAmounts.intValue)); 

How can I automatically display the calculated difference of the two sums at startup without manually executing the action?

Thanks again.

Paul


You don't need an action, you need a model key you can bind to just as you do with the sums. Then you bind that to the label's display(?) property and it should be called automatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消