ios – Customized Markers View in Google Map displacing view inside it in Swift


I’ve made a xib file of marker (Customized Marker), and assigning that xib file to marker.icon property. This xib file have superView and picture inside it, However when it renders on Google Map, picture inside SuperView displaces from the underside as proven in connected picture.

And it’s taking place once I give Google Map View backside constraints from superView of the ViewController. From safeArea, it’s working effective. I’ve tried in iPhoneX.

Assigning Xib file to Google Marker.

marker.iconView = createMarker(projectIndex: i)

Getting ready marker methodology:

non-public func createMarker(projectIndex: Int) -> UIView {
        let marker = MapMarker(body: CGRect(x: 0, y: 0, width: 50, peak: 50))
        marker.updateMarker(mission: tasks[projectIndex])
        marker.tag = projectIndex
        marker.addGestureRecognizer(UITapGestureRecognizer(goal: self, motion: #selector(onTapMarker)))
        return marker
}

Beneath is Marker xib file.
enter image description here

enter image description here

I’ve spent hours on it however unable to search out the bug, Please assist me remedy this. Thanks!

Leave a Reply