这是我创建 UIAlertController 的代码:
// Create the alert controller
var alertController = UIAlertController(title: "Are you sure you want to call \(self.number)?", message: "", preferredStyle: .Alert)
// Create the actions
var okAction = UIAlertAction(title: "Call", style: UIAlertActionStyle.Default) {
UIAlertAction in
var url:NSURL = NSURL(string: "tel://\(self.number)")!
UIApplication.sharedApplication().openURL(url)
}
var cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel) {
UIAlertAction in
}
// Add the actions
alertController.addAction(okAction)
alertController.addAction(cancelAction)
// Present the controller
self.presentViewController(alertController, animated: true, completion: nil)
我无法弄清如何更改取消和通话操作的文本颜色。标题文本当前为黑色,取消和通话按钮为白色。我想使它们全部变为黑色,以提高可见性。有什么建议吗?谢谢!
UIAlertController
按钮的tintColor
:https://dev59.com/Yl8d5IYBdhLWcg3wxUjC#32636878 - peacetype