我想使用以下代码使用我自己的字体自定义所有按钮:
// Custom fonts for button with tag
for (UIButton *customButton in [[self view] subviews]) {
if (customButton.tag == 1) {
customButton.titleLabel.font = [UIFont fontWithName:@"OpenSans-Regular" size:14];
}
}
但我在调试器控制台上收到此错误消息:
2013-09-21 00:33:33.160 Test[794:907] -[UILabel titleLabel]: unrecognized selector sent to instance 0x1dda8d80
2013-09-21 00:33:33.165 Test[794:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel titleLabel]: unrecognized selector sent to instance 0x1dda8d80'
我做错了什么?我正在使用 XCode 4.6.3 并针对 iOS6。谢谢你...