How can I set the differnt font to UIButton dynamically?

I want to dynamically adjust the font for the button name, since I can set it.

+3
source share
2 answers
UIButton *button        = [UIButton buttonWithType: UIButtonTypeRoundedRect];
button.titleLabel.font  = [UIFont fontWithName:@"font name" size:12];
+21
source
[tmp setFont:[UIFont fontWithName:@"American Typewriter" size:18]];

the font name takes it from the array and continues to change the index.

So it will look like

[tmp setFont:[UIFont fontWithName:[fontArray objectAtIndex:desiredIndex] size:18]];
0
source

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


All Articles