Mac Developer Library

Developer

DRMSFFormatter Class Reference

Options
Deployment Target:

On This Page

DRMSFFormatter

NSFormatter subclass

Instances of DRMSFFormatter format the textual representation of cells that contain MSF objects and convert textual representations of msf values into MSF objects. DRMSFFormatters are typically instantiated in IB using the DiscRecording Interface builder palette.

  • Returns the format string to the caller

    Declaration

    - (NSString*) format;

  • Initializes the formatter with the format string

    Declaration

    - (id) initWithFormat:(NSString*)format;

    Parameters

    format

    An NString specifying the printf-style format string.

    Return Value

    A DRMSFFormatter

  • Sets the format string of the receiver

    Declaration

    - (void) setFormat:(NSString*)format;

    Parameters

    format

    An NString specifying the printf-style format string.

    Discussion

    The format string is very similar to a printf-style format string with %-escaped formatting characters.

    • %% A "%" character

    • %m Minutes as a decimal number

    • %s Seconds as a decimal number

    • %f Frames as a decimal number

    In addition to these formatting characters an optional length specifier can come between then % and the formatting character. This length specifier will force the field in question to be at least that wide. for example a format specifier of "%02m:%02s" will cause a DRMSF object representing 3 minutes 9 seconds to be formatted as "03:09".

    A formatter is aware of and respects rounding. If a bit of the msf is not zero, but the format does not display that value, the next higher value will be increased by one to reflect that. Extending our example above, an DRMSF with a value of 3 minutes, 9 seconds, 15 frames using a format specfier of "%02m:%02s", will be formatted as "03:10" since the 15 frames rounds up the seconds to the next value