Tôi đã sử dụng minimumFontSizetrước đây nhưng chức năng đó hiện không được dùng nữa và tôi không hiểu rõ về cách minimumScaleFactorhoạt động.
Tôi muốn kích thước phông chữ tối đa là 10 và tối thiểu là 7.
Làm cách nào để tôi có thể giảm kích thước lại thành cỡ chữ 7 với hệ số tỷ lệ?
UILabel sự sáng tạo:
UILabel *label = [[UILabel alloc] init];
[label setTranslatesAutoresizingMaskIntoConstraints:NO];
label.text = [labelName uppercaseString];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.font = [UIFont fontWithName:HELVETICA_FONT_STYLE_BOLD size:9.5];
label.backgroundColor = [UIColor clearColor];
label.minimumScaleFactor = .1f;
[label addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[label(WIDTH)]"
options:0
metrics:@{@"WIDTH" : [NSNumber numberWithFloat:buttonSize.width]}
views:NSDictionaryOfVariableBindings(label)]];
[contentView addSubview:label];