MMMStylesheetScaleConverter

Objective-C

@interface MMMStylesheetScaleConverter : NSObject <MMMStylesheetConverter>

Swift

class MMMStylesheetScaleConverter : NSObject, MMMStylesheetConverter

Dimension converter that uses a table of scales.

  • Initializes the converter with an explicit table of scales. Every value coming to convertFloat:fromSizeClass: will be returned multiplied by scales[sourceSizeClass].

    Declaration

    Objective-C

    - (nonnull id)initWithScales:
        (nonnull NSDictionary<NSString *, NSNumber *> *)scales;

    Swift

    init(scales: [String : NSNumber])
  • Initializes the converter with a target size class and a table of dimensions associated with every size class (e.g screen width).

    Every value coming to convertFloat:fromSizeClass: will be returned adjusted proportionally to the ratio of the dimensions associated with target and source size classes, i.e. it will be multiplied by scales[targetSizeClass] / scales[sourceSizeClass].

    So for a table of screen widths the converter will upscale or downscale dimensions between size classes proprtionally to the ratios of screen width associated with size classes.

    Declaration

    Objective-C

    - (nonnull id)initWithTargetSizeClass:(nonnull NSString *)targetSizeClass
                               dimensions:
                                   (nonnull NSDictionary<NSString *, NSNumber *> *)
                                       dimensions;

    Swift

    convenience init(targetSizeClass: String, dimensions: [String : NSNumber])
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (id)init NS_UNAVAILABLE;