Search code examples
iosswiftuiimageviewuiimagemkmapview

How to show UIImage in MKMapView


I have an MKMapView in my View, and if I cant find a specific location I would like to show an UIImage in it. Is there any way I can do in swift 4?


Solution

  • Try the following code:

        let imageView = UIImageView(frame: mapView.frame)
        imageView.image = UIImage(named: "YOUR IMAGE NAME")
        mapView.addSubview(imageView)