Cropped characters - iOS11 - Alert Dialog

↘锁芯ラ 提交于 2019-12-19 11:58:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!