Hello,
I'm working on using interface builder w/ STV for the first time and am running into some issues.
The first issue that I cannot seem to resolve involves using curly brace binding. I watched the video for UI Customization and what I am trying to achieve is similar to what is mentioned around 2:00. I have a cell that I added an additional label and using curly brace binding I specify what to have displayed there. It works like a charm.
The problem is that this value is an NSNumber that I need to display as currency.
Here is what I have tried so far:
self.tableViewModel.cellActions.didLoadBoundValue = ^NSObject*(SCTableViewCell *cell, NSIndexPath *indexPath, NSObject *value) { NSString *formattedValue = (NSString *)value; if ([cell.boundPropertyName isEqualToString:@"laborCostAmt"]) { NSNumber *actualValue = [cell.boundObject valueForKey:cell.boundPropertyName]; if (actualValue != nil) { formattedValue = [[NSNumberFormatter currencyFormatter] stringFromNumber:actualValue]; } } return formattedValue; };
Stepping through the debugger and using "po" this seems to behave as expected. However the formatted value does not actually display in the cell. Instead, the float value displays (ex "888.2" displays instead of "$888.20").
I also tried using both willConfigure and willDisplay cell actions to grab the SCNumericTextFieldCell, then changing it's numberFormatter property to be NSNumberFormatterCurrencyStyle. Neither of these worked.
Does anyone have a suggestion for the correct way to format these curly brace bound labels?