swift - MapKit IOS Not Centering on Pin -
i'm having issue mapkit not centering on pin have set. instead loading this.
i've tried multiple different things, example issue related mapkit properties in storyboard? maybe don't think so. can't seem find on web relating issue? here code believe might relevant:
import uikit import mapkit import foundation class first: uiviewcontroller { @iboutlet var map: mkmapview! override func viewdidload() { var location = cllocationcoordinate2dmake(-37.81411, 144.96328) var span = mkcoordinatespanmake(0.1, 0.1) var region = mkcoordinateregion(center: location, span: span) map.setregion(region, animated: true) var annotation = mkpointannotation() annotation.coordinate = location annotation.title = "pizza pistorante" annotation.subtitle = "luna rossa" // add annotation scene map.addannotation(annotation) } }
add constraint mapview way:
select mapview storyboard go pin menu , add 4 constraint shown in below image:

and map annotation display @ center.
Comments
Post a Comment