【发布时间】:2011-09-23 05:24:55
【问题描述】:
我已经设置好让我的 MKMapView 显示当前位置。我还为其他引脚实现了一个自定义引脚。然而,事实证明当前位置显示为自定义图钉,而我只是希望它是一个普通的蓝色圆圈(就像谷歌地图一样)。
我在我的代码中定义了以下内容:
- (MKAnnotationView *) mapView: (MKMapView *) mapView viewForAnnotation: (id<MKAnnotation>) annotation MKAnnotationView *pin = (MKAnnotationView *) [self.mapView dequeueReusableAnnotationViewWithIdentifier: @"VoteSpotPin"];
if (pin == nil)
{
pin = [[[MKAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: @"TestPin"] autorelease];
}
else
{
pin.annotation = annotation;
}
[pin setImage:[UIImage imageNamed:@"TestPin.png"]];
pin.canShowCallout = YES;
pin.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
return pin;
}
如何防止当前位置显示为图钉?
【问题讨论】:
-
mapView.showsUserLocation=YES 然后它将显示当前位置。如果您想在当前位置显示图钉,请将当前位置 lat lon 传递给该注释;
-
我这样做了,它将当前位置显示为我拥有的自定义图钉,而不是蓝色圆圈。这实际上是真正的问题
-
您是否检查过您的应用程序是否支持设备或模拟器中的位置管理器问题
标签: iphone objective-c ipad mkmapview