GMS Marker fixed to center of map in Swift -
how 1 ensure gms marker remains fixed on centre of map allowing map dragged not marker?
thanks
you can add vertical , horizontal constraints align marker view.
let xconstraint = nslayoutconstraint(item: yourmarkerview, attribute: .centerx, relatedby: .equal, toitem: self.yourmapview, attribute: .centerx, multiplier: 1, constant: 0) let yconstraint = nslayoutconstraint(item: yourmarkerview, attribute: .centery, relatedby: .equal, toitem: self.yourmapview, attribute: .centery, multiplier: 1, constant: 0) self.yourmapview.addconstraint(xconstraint) self.yourmapview.addconstraint(yconstraint)
also make sure have constraints added yourmapview. (you can add them in storyboard.)
Comments
Post a Comment