在xCode中本地化自定义UIButton
我在尝试向自定义按钮添加本地化标签时遇到了困难 我试过这个:在xCode中本地化自定义UIButton,xcode,localization,uibutton,uilabel,Xcode,Localization,Uibutton,Uilabel,我在尝试向自定义按钮添加本地化标签时遇到了困难 我试过这个: [button1 setImage:[UIImage imageNamed:buttonFile] forState: UIControlStateNormal]; NSString *buttonTitle = NSLocalizedString(@"RECORD", @""); [button1 setTitle:buttonTitle forState:UIControlStateNormal]; 这: 这是
[button1 setImage:[UIImage imageNamed:buttonFile] forState: UIControlStateNormal];
NSString *buttonTitle = NSLocalizedString(@"RECORD", @"");
[button1 setTitle:buttonTitle forState:UIControlStateNormal];
这:
这是:
button1.titleLabel.text = NSLocalizedString(@"RECORD", @"");
我能看到按钮,但看不到标签。如果我删除按钮图像,我可以看到标签。我真的希望两者都有,而且我不希望每种语言都有按钮,尽管这是可能的
有更好的方法吗
谢谢 使用setBackgroundImage:ForState:而不是setImage:
button1.titleLabel.text = NSLocalizedString(@"RECORD", @"");