I have a stopwatch feature in my app that uses a centered attributed UILabel
with a proportionally spaced font to render time. At every time increment the width
Use a monospaced font or pass parameters when creating the font which force monospaced numbers:
//kNumberSpacingType 6
//kMonospacedNumbersSelector 0
NSArray *setting = @[
@{
UIFontFeatureTypeIdentifierKey: @(6),
UIFontFeatureSelectorIdentifierKey: @(0)
}
];
return [UIFont fontWithDescriptor:[[self fontDescriptor] fontDescriptorByAddingAttributes:@{UIFontDescriptorFeatureSettingsAttribute : setting}] size:0.0];