Apple 官方文件:
使用範例:
"IdelTimeOutMessage" = "Idle time out exceeded, please input your password for account:%1$@";
附註:請使用 %@ , 不要用 %s ,不然會 crash
完整的範例:
let idleTimeoutMessage = String(format: NSLocalizedString(“IdelTimeOutMessage”, comment: “”), user_id)
let alert:UIAlertController = UIAlertController(title: NSLocalizedString(“Alert”, comment: “”),
message: idleTimeoutMessage,
preferredStyle: UIAlertControllerStyle.alert)
let defaultAction:UIAlertAction = UIAlertAction(title: “OK”,
style: UIAlertActionStyle.default,
handler:{
(action:UIAlertAction!) -> Void in
print(“OK”)