Skip navigation.
 
mlRe: Value With Pattern formatting with Bindings
FROM : mmalcolm crawford
DATE : Thu Dec 09 02:09:19 2004

On Dec 8, 2004, at 4:44 PM, Fred Glover wrote:

> I am successfully binding NSTextViews to my model data path with the
> Value With Pattern - DisplayPatternValue1 method in IB.
> However, for the life of me I can't make printf type format statements
> work.
> [...]
> Ideally I'd like it formatted something like  33.33%. And no, it's not
> possible to round my model data to the desired number of decimal
> places or digits.
> Do I need a custom formatter?
>

Without testing, two possibilities come to mind:

(a) Use a value transformer for that element in the pattern (the output
value would be a suitably formatted string);
(b) If you have a particularly complicated string to display (that's
based solely on the model object), then implement a custom description
method (not a method called 'description', just one the returns a
description in the right format) and bind to that instead.

mmalc

Related mailsAuthorDate
mlValue With Pattern formatting with Bindings Fred Glover Dec 9, 01:44
mlRe: Value With Pattern formatting with Bindings mmalcolm crawford Dec 9, 02:09