I have this code:
var zdjecieGlowne: UIImage? = nil
let alert = UIAlertController(title:"MyTitle", message: "My Message Box ", preferredStyle: UIAlertControllerStyle.alert)
let saveAction = UIAlertAction(title: "MyTitle", style: .default, handler: nil)
//saveAction.setValue(UIImage(named: "logo")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal), forKey: "image")
saveAction.setValue(zdjecieGlowne, forKey: "image")
dump(zdjecieGlowne)
alert.addAction(saveAction)
alert.addAction(UIAlertAction(title: "Option 1", style: UIAlertActionStyle.default, handler: { alertAction in
//alert.dismiss(animated: true, completion: nil)
print("1 pressed")
}))
alert.addAction(UIAlertAction(title: "Option 2", style: UIAlertActionStyle.default, handler: { alertAction in
//alert.dismiss(animated: true, completion: nil)
print("2 pressed")
}))
alert.addAction(UIAlertAction(title: "Option 3", style: UIAlertActionStyle.default, handler: { alertAction in
//alert.dismiss(animated: true, completion: nil)
print("3 pressed")
}))
self.present(alert, animated: true, completion: nil)
As a result, I receive Alert with a blue background instead of a picture. Why is it like that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…