Search code examples
cocoacocoa-bindingsnsarraycontroller

Simple binding questions


I am trying a simple application which is like this-

View:

  1. A table view showing count of entity 1 in first column and count of entity 2 in second column. Here each row specifies count of different entities at a particular date.

  2. A text field showing- total count of entity 1 multiplied by 35.

  3. A text field showing- sum of count of entities in both the columns.

eg.

(entity1) (entity2)

<2> <3>

<4> <2>

<5> <7>

requirement 1: text field specified in pt. 2 should show - 385 ie. (11 * 35)

requirement 2: text field specified in pt. 3 should show - 23 ie. (11 + 12)

Model:

An object with two properties:

int entity1Count

int entity2Count

I am using an array controller object to show data in table view.

My question is -

Can I implement my requirements via bindings in IB? If yes then how?

Thanks,

Miraaj


Solution

  • I am able to implement requirement 1, via bindings in IB using NSNumberFormatter and its multiplier property :)

    but I am still unable to implement requirement 2 :(

    Any suggestion ?

    Thanks,

    Miraaj