ios - swift : Where can I find a list of all the forkey arguments available for Alert actions

标签 ios uialertcontroller

//this is the cancel button code

let cancelAction = UIAlertAction(title: "Cancel", style: 
UIAlertActionStyle.cancel, handler: {(action) -> Void in
        alert.dismiss(animated: true, completion: nil)})

cancelAction.setValue(UIColor.white(), forKey: "titleTextColor")
cancelAction.setValue(UIColor.equiaviaBlue(), forKey: "backgroundColor")

.....但是没有 backgroundColor forKey。 有谁知道我在哪里可以找到 forKey 变量的参数列表?

最佳答案

AFAICT,titleTextColor 属性似乎没有在任何地方记录,这意味着以这种方式设置它可能构成私有(private) API 使用,并可能使您的应用程序被 App Store 禁止。如果 UIAlertAction 的内部实现在未来发生变化,它也可能导致您的应用程序崩溃。此外,使用类转储检查 UIKit 二进制文件,似乎没有任何明显的属性对应于背景颜色。因此,您可能无法完成您想要做的事情,而且无论如何也不建议这样做。

关于ios - swift : Where can I find a list of all the forkey arguments available for Alert actions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49100721/

相关文章:

iphone - 带有两个标题的 UICollectionView

iphone - 如何使用 iOS GPUImage 生成直方图?

ios - 如何获取 iOS 设备型号(例如 A1530)?

swift - 如何在 UIAlertController 中以编程方式更改特定按钮文本颜色

ios - UialertController 仅在 var 达到特定值时显示一次

ios - 确定用户是否关闭推送通知弹出(同时显示多个警告框)

swift - 如何更改 UIAlertController 高度?

ios - 在 subview Controller 之间切换

objective-c - 绘制矩形看到空数组

Swift - AVAudioPlayer,声音无法正确播放