Cropped characters - iOS11 - Alert Dialog

2019-02-21 07:33发布

Cropped characters - iOS11 - Alert Dialog. How to fix it?

[Example]


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条回答
女痞
2楼-- · 2019-02-21 08:04

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)
查看更多
登录 后发表回答