如何在UIButton上动态设置不同的字体?

Ank*_*yas 3 iphone uibutton ios4

我想动态设置按钮标题的自定义字体,以便如何设置它.

aih*_*ham 21

UIButton *button        = [UIButton buttonWithType: UIButtonTypeRoundedRect];
button.titleLabel.font  = [UIFont fontWithName:@"font name" size:12];
Run Code Online (Sandbox Code Playgroud)