let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert) let action = UIAlertAction(title: "OK", style: .default, handler: nil) let imgTitle = UIImage(named:"imgTitle.png") let imgViewTitle = UIImageView(frame: CGRect(x: 10, y: 10, width: 30, height: 30)) imgViewTitle.image = imgTitle alert.view.addSubview(imgViewTitle) alert.addAction(action) self.present(alert, animated: true, completion: nil)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter