-
Notifications
You must be signed in to change notification settings - Fork 3
CupByteCountTransformer
This class is a CPValueTransformer
that converts numbers into formatted byte counts by using a CPByteCountFormatter
. For information on how byte counts are formatted, see the Apple documentation.
By default this class uses a shared formatter with the following properties:
- adaptive: YES
- allowedUnits: CPByteCountFormatterUseKB | CPByteCountFormatterUseMB | CPByteCountFormatterUseGB
- allowsNonNumericFormatting: NO
- zeroPadsFractionDigits: YES
If you want to change the properties of the shared formatter, you can retrieve it with the +sharedFormatter
method.
If you want to change the properties of the formatter for a specific transformer instance, you can either create a new CPByteCountFormatter
yourself and use the -setFormatter:
method, or use the -formatter
method, which will return a new instance of CPByteCountFormatter
that belongs to the transformer instance. You can then set the properties of the returned formatter as you wish.
Returns the receiver's instance of CPByteCountFormatter
. If the receiver does not yet have its own formatter, a new CPByteCountFormatter
is assigned and then returned.
Sets the formatter used by the receiver. If aFormatter
is nil, the shared formatter will be used when transforming values.