当我显示UIAlertController
时,有没有办法将第一个字母默认为大写?
var alertController = UIAlertController(title: i18nEnterPersonName, message: nil, preferredStyle: .Alert)
// initialization of alertController...
presentViewController(alertController, animated: true, completion: nil)
答案 0 :(得分:2)
这样做:
let alertMessage = "i18nEnterPersonName".capitalizedString
var alertController = UIAlertController(title: alertMessage, message: nil, preferredStyle: .Alert)
如果i18nEnterPersonName是变量的(我认为它是一个字符串),那么这样做:
var alertController = UIAlertController(title: i18nEnterPersonName.capitalizedString, message: nil, preferredStyle: .Alert)