我有代码检查插入只能从数字。应用程序本地化(IOS)
如何使用Localizable.strings翻译“:无法粘贴”?
let pastAction = UIAlertAction(title: NSLocalizedString("Past",comment: ""), style: .default, handler: {
(alert: UIAlertAction!) -> Void in
if UIPasteboard.general.string?.onlyNumbers() == "" {
let alertController = UIAlertController(title: "Calc Pro", message: "\(UIPasteboard.general.string ?? ""): cannot be pasted", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alertController, animated: false, completion: nil)
alertController.view.tintColor = UIColor(colorLiteralRed: 235/255, green: 92/255, blue: 48/255, alpha: 1)
print("Cannot be pasted")
} else {
self.displayResultLabel.text = UIPasteboard.general.string
print("Pasted")
}
})
扫描[这些搜索结果] (https://stackoverflow.com/search?q=%5Bswift%5D+NSLocalizedString+variable)以获取更多解决方案。 – rmaddy