当我显示 UIAlertController
时,有没有办法将第一个字母默认为 大写?
var alertController = UIAlertController(title: i18nEnterPersonName, message: nil, preferredStyle: .Alert)
// initialization of alertController...
presentViewController(alertController, animated: true, completion: nil)
最佳答案
这样做:
let alertMessage = "i18nEnterPersonName".capitalizedString
var alertController = UIAlertController(title: alertMessage, message: nil, preferredStyle: .Alert)
如果 i18nEnterPersonName 是可变的(我认为它是一个字符串),那么这样做:
var alertController = UIAlertController(title: i18nEnterPersonName.capitalizedString, message: nil, preferredStyle: .Alert)
关于ios - UIAlertController 默认首字母大写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31097047/