Ankit Vyas
Ankit Vyas

Reputation: 7501

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.

Upvotes: 3

Views: 8333

Answers (2)

ayush
ayush

Reputation: 14568

[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]];

Upvotes: 0

aiham
aiham

Reputation: 3614

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

Upvotes: 21

Related Questions