Bild zu UIAlertController hinzufügen [geschlossen]
Ich möchte UIAlertController ein Bild hinzufügen. Das Bild muss sich nicht auf einer Schaltfläche befinden, sondern muss nur in der Mitte des Controllers angezeigt werden. Der Code, den ich habe, ist unten, stürzt jedoch mit der Meldung "Unbekannter Selektor an Instanz gesendet" a
func showAlert () {
let alert = UIAlertController(title: "Title of Alert",
message: "none",
preferredStyle:UIAlertControllerStyle.ActionSheet)
// add an image
let image = UIImage(named: "example")
var imageView = UIImageView(image: image)
imageView.frame = CGRectMake(0, 0, 100, 100)
var imageAction = UIAlertAction(title: "", style:.Default, handler: nil)
imageAction.setValue(imageView, forKey: "image")
alert.addAction(imageAction)
// add a continue button
var action = UIAlertAction(title: "Continue", style:.Default, handler: {(alert:UIAlertAction!) in self.continue() })
alert.addAction(action)
// show the UIAlertController
self.presentViewController(alert, animated: true, completion: nil)
}