Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add icons to options in action sheets : iOS?

I am trying to add the icons in action sheet of iOS app. I saw that apple has implemented such behavior in AppStore's action sheet, but hasn't provided any callback method to implement it ?

Any suggestions on how to implement it on iOS 12 Swift 4.x Xcode10.x ??

Action sheet with images.


1 Answers

You can add image to UIAlertAction with image key:

let image = UIImage(named: "IMAGE_NAME")
var alertAction = UIAlertAction(title: "TITLE", style: .default, handler: nil)
alertAction.setValue(image, forKey: "image")
like image 93
Rocky Avatar answered Sep 13 '25 05:09

Rocky