开发者

How store data when click on map?

开发者 https://www.devze.com 2023-03-31 22:44 出处:网络
I am making an application in which i have map view where map is zoom in. When user click on map then drop an annotation 开发者_StackOverflow社区. When annotation drop on that address then that addres

I am making an application in which i have map view where map is zoom in. When user click on map then drop an annotation 开发者_StackOverflow社区. When annotation drop on that address then that address will be store in an string. How store data in string from mapview?


You mean the : latitute and longitude?

// Assume  you declare MKMapView *mapView;
CGPoint point = [sender locationInView:self.mapView];
CLLocationCoordinate2D locCoord =[self.mapView convertPoint:point toCoordinateFromView:self.mapView];

NSString *yourAddress = [NSString stringWithFormat:@"Lat: %f, Lng: %f", locCoord.latitude, locCoord.longitude];

Hope this is what you want, if not be more specified of what you want to achieve, I will try to help.

EDIT:

If location is what you want, this might be of help: http://stackoverflow.com/questions/3822297/read-current-location-name-using-map-view-in-iphone

Credits to: MathieuF who posted the sample code.

0

精彩评论

暂无评论...
验证码 换一张
取 消