按下 UIAlertViewController 行时更改背景颜色
Change background color when UIAlertViewController row is pressed down
当用户按住 UIAlertController 行时,它自然会在 iPad 上变为灰色,但我想将其设为另一种颜色。我该怎么做?
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertAction.Style.default, handler: { action in
}))
alert.addAction(UIAlertAction(title: "Settings", style: UIAlertAction.Style.default, handler: { action in
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, completionHandler: nil)
}))
self.present(alert, animated: true, completion: nil)
当您按住一行时,iPhone 会执行此操作。我想改变那个背景颜色。
你不能。
Important
The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
来源:https://developer.apple.com/documentation/uikit/uialertcontroller
当用户按住 UIAlertController 行时,它自然会在 iPad 上变为灰色,但我想将其设为另一种颜色。我该怎么做?
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertAction.Style.default, handler: { action in
}))
alert.addAction(UIAlertAction(title: "Settings", style: UIAlertAction.Style.default, handler: { action in
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, completionHandler: nil)
}))
self.present(alert, animated: true, completion: nil)
当您按住一行时,iPhone 会执行此操作。我想改变那个背景颜色。
你不能。
Important
The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
来源:https://developer.apple.com/documentation/uikit/uialertcontroller