monospacedDigit system font does not work with auto-resize

Originator:rene.jc.dekker
Number:rdar://24074201 Date Originated:2016-1-6
Status:Open Resolved:
Product:iOS Product Version:9.2
Classification:UI/Usability Reproducible:Always
 
Summary:
The problem comes up when using a "mono-spaced-digit" version of the System font, for example in a count-down timer. When that is used in a UITextField which has auto-resizing enabled, then it switches to flexible-width-digits after auto-resizing kicks in.

Steps to Reproduce:
1. Setup a UITextField with auto-resizing enabled and mono-spaced digits. For example:

UITextField *field = [[UITextField alloc] initWithFrame:frame];
field.minimumFontSize = 20;
field.font = [UIFont monospacedDigitSystemFontOfSize:44 weight:UIFontWeightSemibold];
field.adjustsFontSizeToFitWidth = YES;

2. Put some text with digits in the field
3. Resize the field such that the text does not fit anymore with the original font size. 


Expected Results:
The digits to keep an identical width for all digits. 

Actual Results:
The digits switch to dynamic font width, such that a number that is counting will wiggle around because of the varying digit widths. 

Version:
9.2 (13C75)

Notes:
Code tested with XCode Version 7.2 (7C68).
See also http://stackoverflow.com/questions/34594614/auto-resize-a-monospaceddigit-font-in-ios-9

Configuration:
iPhone 6

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!