问题
Cropped characters - iOS11 - Alert Dialog. How to fix it?
[
func settingsButtonPressed() {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let closeAction = UIAlertAction(title: "Anuluj", style: .cancel) { (action) in
//do nothing
}
alert.addAction(closeAction)
let restorePurchases = UIAlertAction(title: "Przywróć zakupy", style: .default) { (action) in
self.restorePurchases()
}
alert.addAction(restorePurchases)
let refreshCatalogs = UIAlertAction(title: "Odśwież", style: .default) { (action) in
self.collectionView.reloadData()
}
alert.addAction(refreshCatalogs)
let delPubs = UIAlertAction(title: "Usuń publikacje", style: .destructive) { (action) in
self.deletePublications()
}
alert.addAction(delPubs)
present(alert, animated: true, completion: nil)
}
回答1:
Try to use NSLocalizedString
instead of hardcoded values. Usage article here.
Then just define your titles like that:
let cancelButtonText = NSLocalizedString("Cancel", comment: "")
And set it:
let cancelAction = UIAlertAction(title: cancelButtonText, style: .cancel, handler: nil)
来源:https://stackoverflow.com/questions/49407703/cropped-characters-ios11-alert-dialog