Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IconRenderer Warning in Xcode 11.2

I just created a new iOS Single View App and I try to build and run it. I had received the warning as below:

[Renderer] IconRenderer: HorizontalStretchPadding (18.000000, 18.000000) is larger than the image size (34.000000, 54.000000). Image will now use the center column of pixels to stretch.

This warning keeps showing multiple times.

like image 988
aznelite89 Avatar asked Oct 24 '19 07:10

aznelite89


2 Answers

I met with this warning, when I was programmatically selecting the MKMarkerAnnotationView in animated fashion.

I resolved my UI issues, by calling prepareForDisplay API on MKMarkerAnnotationView:


if #available(iOS 11.0, *) {
    let view = mapView.view(for: annotation)
    view?.prepareForDisplay()
}

Let me know if this helps.

Best, Boris

like image 81
deathhorse Avatar answered Oct 23 '22 03:10

deathhorse


I thought about this warning for a long time, and after a while I found out what my problem was. When creating a map with the MapKit framework, the program returned this error depending on the values that were passed as latitudeDelta and longitudeDelta in MKCoordinateSpan. So, I just reduced these values, which brought the map closer, but the warnings stopped appearing. My working code is error-free:

import SwiftUI
import MapKit

struct MapView: View {
    var coordinate: CLLocationCoordinate2D
    
    @State private var region = MKCoordinateRegion()
    
    var body: some View {
        Map(coordinateRegion: $region).onAppear() {
            setRegion(coordinate)
        }
    }
    
    private func setRegion(_ coordinate: CLLocationCoordinate2D) {
        region = MKCoordinateRegion(center: coordinate, span: MKCoordinateSpan(latitudeDelta: 0.040, longitudeDelta: 0.040))
    }
}

struct MapView_Previews: PreviewProvider {
    static var previews: some View {
        MapView1(coordinate: CLLocationCoordinate2D(latitude: 55.7522200, longitude:  37.6155600))
    }

}

Before that, the values were as follows:: region = MKCoordinateRegion(center: coordinate, span: MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1))

like image 1
Eldar Avatar answered Oct 23 '22 05:10

Eldar