裁剪的字符 - iOS11 - 警报对话框

时间:2018-03-21 13:30:56

标签: ios xcode alertdialog uialertview ios11

裁剪的字符 - iOS11 - 警报对话框。 如何解决?

[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 个答案:

答案 0 :(得分:0)

尝试使用NSLocalizedString而不是硬编码值。 Usage article here

然后只需定义你的标题:

let cancelButtonText = NSLocalizedString("Cancel", comment: "")

并设置它:

let cancelAction = UIAlertAction(title: cancelButtonText, style: .cancel, handler: nil)