Skip to content

8. Alerts With Images

Gabriel Theodoropoulos edited this page Apr 17, 2019 · 1 revision

Alerts with images

GTAlertCollection also offers the possibility to present an alert controller with an image view in it, and multiple action buttons. Here's how to do that:

GTAlertCollection.shared.presentImageViewAlert(withTitle: "Your Avatar", message: "What do you want to do with it?", buttonTitles: ["Change it", "Remove it", "Cancel"], cancelButtonIndex: 2, destructiveButtonIndices: [1], image: image) { (actionIndex) in

    print("You tapped on button at index \(actionIndex)")
}

Most of the parameters have been already discussed, but there's a new one called image. Use it to specify the image you want to be displayed to the image view of the alert.

Imageview alert

Clone this wiki locally