这是我的else-if函数:
override func viewDidLoad() {
super.viewDidLoad()
if volumeBool {
volumeOut.setTitle("SOUND ON", forState: UIControlState.Normal)
} else {
volumeOut.setTitle("SOUND OFF", forState: UIControlState.Normal)
}
感谢您的帮助。
答案 0 :(得分:0)
使用
NSLocalizedString("string to translate", comment: "comment for the language file")
所以在viewDidLoad
:
override func viewDidLoad() {
super.viewDidLoad()
if volumeBool {
volumeOut.setTitle(NSLocalizedString("SOUND ON", comment: "Title for sound on"), forState: UIControlState.Normal)
}
else {
volumeOut.setTitle(NSLocalizedString("SOUND OFF", comment: "Title for sound off"), forState: UIControlState.Normal)
}
}