UIButton - How to set the minimum font size?

My question is simple. Is it possible to set a minimum font size for UIButton , how can this be easily configured using UILabel ?

+6
source share
3 answers
 button.titleLabel.numberOfLines = 1; button.titleLabel.adjustsFontSizeToFitWidth = YES; button.titleLabel.lineBreakMode = NSLineBreakByClipping; 

copied from Set minimum UIButton font size with field

+28
source

Set Minimumfontsize is not available on iOS8, use minscalefactor instead.

+3
source

Answer Anoop works like a charm. You can also do this in IB using custom runtime attributes:
- select the button in IB
- Add attribute
- KeyPath: titleLabel.adjustsFontSizeToFitWidth
- Type: Logic
- Value: true
Screenshot from IB

+2
source

Source: https://habr.com/ru/post/979399/


All Articles