I tried to show map icons in UIAlertController, but when image do not have transparent background I will get fill gray color
let customView = UIView()
// customView.translatesAutoresizingMaskIntoConstraints = false
customView.backgroundColor = .clear
customView.addConstraint(NSLayoutConstraint(item: customView,
attribute: .height,
relatedBy: .equal,
toItem: nil,
attribute: .notAnAttribute,
multiplier: 1,
constant: 100))
var marginBtns:CGFloat = 10
if yandexMap {
let yandexBtn = UIButton()
yandexBtn.frame = CGRect(x: marginBtns, y: margin, width: 30, height: 30)
yandexBtn.setImage(UIImage(named: "yandex")?.withRenderingMode(.alwaysOriginal), for: .normal)
yandexBtn.sizeToFit()
yandexBtn.imageView!.layer.cornerRadius = 5
urlYandexAction = urlYandex
yandexBtn.addTarget(self, action: #selector(actionYandexBtn), for: .touchUpInside)
marginBtns += 70
customView.addSubview(yandexBtn)
//alert.addAction(alertYandex)
}
...
let alert = UIAlertController(title: "Open in",
customView: customView,
fallbackMessage: "",
preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
present(alert, animated: true)
but I get
its not original image color, how can I fix that ?