0

Let's say I have an Entity named Values and it has three attributes: A, B and SUM.

I have a tableview where Column A and Column B is bound to the attributes A and B. The user can change the values of the first to columns (A,B) but not the third (SUM).

Now to my question: The user should not be able to edit the third column (SUM). That column should only show the sum of A * B. How can I accomplish that? Can I use bindings in IB for that as well?

Many thanks.

SUM = A*B

Mikael
  • 3,572
  • 1
  • 30
  • 43

1 Answers1

0

I fixed it by adding a variable to my entity subclass:

- (NSUInteger) sumOf1And2 {
    NSUInteger value1 = [self.a intValue];
    NSUInteger value2 = [self.b intValue];

    return value1 + value2;
}
Mikael
  • 3,572
  • 1
  • 30
  • 43