我无法找到更改inputAccessoryView
中按钮字体的方法。有人可以帮我吗?
答案 0 :(得分:0)
要更改UIBarButtonItem的字体,请使用:
[buttonItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Helvetica-Bold" size:26.0], UITextAttributeFont,nil] forState:UIControlStateNormal];
答案 1 :(得分:0)
如果您要部署iOS 5.0+,则可以使用UIAppearance
代理:
UIFont *font = // create your font
[[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], [self class], nil] setTitleTextAttributes:@{ UITextAttributeFont: font } forState:UIControlStateNormal];
此代码将更改UIBarButtonItem
子类中所有UIToolbar
s(包括inputAccessoryView
}中所有UIViewController
s(也称为按钮)的字体。< / p>