how can i set differnt font on UIButton Dynamically?

I want to set custom font for button title dynamically so how can i set it.


UIButton *button        = [UIButton buttonWithType: UIButtonTypeRoundedRect];
button.titleLabel.font  = [UIFont fontWithName:@"font name" size:12];

[tmp setFont:[UIFont fontWithName:@"American Typewriter" size:18]];

the font name take it from an array and keep changing the index.

So it will look like

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

Need Your Help

How to detect if iOS app is running in UI Testing mode

ios xcode-ui-testing

I would like my app to run special code (e.g. resetting its state) when running in UI Testing mode. I looked at environment variables that are set when the app is running from UI Testing and there ...