ios - Custom marker image on swift (MapKit) -
i use custom marker on mapkit
how can change image width , height on custom marker?
my code:
func mapview(mapview: mkmapview!, viewforannotation annotation: mkannotation!) -> mkannotationview! { if (annotation mkuserlocation) { return nil } let reuseid = "test" var anview = mapview.dequeuereusableannotationviewwithidentifier(reuseid) if anview == nil { anview = mkannotationview(annotation: annotation, reuseidentifier: reuseid) anview.image = uiimage(named:"x2.png") anview.canshowcallout = true } else { anview.annotation = annotation } return anview }
try use
anview.frame.size = cgsize(width: 30.0, height: 30.0)
Comments
Post a Comment