如何将updateHeaderNotifications
和DebugAlert分配给NSlocalizedString
?我试图添加updateHeaderNotifications = Nslocalized("text_text")
但它不起作用。谢谢你的帮助
private func initViewToCurrentState(pocketStatus: pocketStatus?) {
if let status = pocketStatus {
switch status {
case .Created:
**updateHeaderNotifications** ("text1")
initpocketBeforeTripView()
case .Paid: fallthrough
case .Undone: fallthrough
case .Aborted: fallthrough
default:
PocketRideService.sharedInstance.removeCachedRide()
dismissViewControllerAnimated(false, completion: {
DebugAlert.show("text")
})
}
}
}
答案 0 :(得分:0)
根据您的方法定义,您可以使用如下:
private func updateHeaderNotifications(bigNotify: String, smallNotify: String) {
bigNotification.text = NSLocalizedString(bigNotify, comment: "bigNotify")//you can set any text for comment parameter
smallNotification.text = NSLocalizedString(smallNotify, comment: "smallNotify")
}
并在您的switch
声明中:
case .Created:
updateHeaderNotifications("text1", smallNotify: "text2")