How store data when click on map?
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.
精彩评论