如何在固定时自动显示地点标题?
我使用地理编码。我尝试在各处设置 animate:YES 但没有帮助。
这是我的代码
@map.m
mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.delegate = self;
mapView.mapType = MKMapTypeStandard;
CLLocationCoordinate2D coord = {latitude: lat, longitude : lon};
MKCoordinateSpan span = {latitudeDelta: 0.001, longitudeDelta: 0.001};
MKCoordinateRegion region = {coord, span};
[mapView setRegion:region animated:YES];
[self.view addSubview:mapView];
MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
[geocoder setDelegate:self];
[geocoder start];
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
mapPlacemark=placemark;
[mapView addAnnotation:placemark];
}
请帮助我或指导我。非常感谢 。 。 。 。
谢谢您的回答。这是代码的结果
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
mapPlacemark=placemark;
[mapView selectAnnotation:placemark animated:YES]; //Use this code.
//[mapView addAnnotation:placemark]; << Don't use this code
}
I use geocode.And I try to set animate:YES everywhere and It didn't help.
here is my code
@map.m
mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.delegate = self;
mapView.mapType = MKMapTypeStandard;
CLLocationCoordinate2D coord = {latitude: lat, longitude : lon};
MKCoordinateSpan span = {latitudeDelta: 0.001, longitudeDelta: 0.001};
MKCoordinateRegion region = {coord, span};
[mapView setRegion:region animated:YES];
[self.view addSubview:mapView];
MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
[geocoder setDelegate:self];
[geocoder start];
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
mapPlacemark=placemark;
[mapView addAnnotation:placemark];
}
please help me or guide me.very thx
.
.
.
.
Thank you for answer. Here is the reesult of code
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
mapPlacemark=placemark;
[mapView selectAnnotation:placemark animated:YES]; //Use this code.
//[mapView addAnnotation:placemark]; << Don't use this code
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个来选择注释。
这是 Apple 参考
确保您已启用 pin 的标注。
Try this to select the annotation.
Here is the Apple reference
Make sure you have enabled the callout for the pin.