开发者

MKReverseGeocoder updating text field

I have the same solution like in Uber app. I want to locate myself (this is simple) and put some pin开发者_如何学Python on the center of screen. When I scroll map, red pin stays in center of screen, and in text field is updated street name where is red pin.

I found that I must to use overlay map for this centered pin, but I don't know what to do with reverse geocoding and text field.

There is some example of this behavior or can you give some sample, or anything how to make this?

MKReverseGeocoder updating text field


1) get the center coordinate

CLLocationCoordinate2D coord = mapview.centerCoordinate;

2) reverse geocode the coordinate

MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
[geocoder setDelegate:self];
[geocoder start];

3) this callback delegate will give you what you want. Check placemark

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜