扩展的mapView:viewForAnnotation现在没有蓝点
我使用以下代码扩展了 MapKit 绘制自定义注释图像的能力:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
NSLog(@"Drawing a cloud on the map");
MKAnnotationView *view;
if(annotation != mapView.userLocation){
view=[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"parkingloc"];
view.image=[UIImage imageNamed:@"placemarkCloud.png"];
[view setCanShowCallout:YES];
[view setRightCalloutAccessoryView:[UIButton buttonWithType:UIButtonTypeDetailDisclosure]];
}
else{
view=
}
return view;
}
我的问题是我应该如何设置 view = 以保留 iPhone 的内置蓝点。您可以看到我消除了为点绘制的自定义图像,但我不知道如何使其显示为默认值。
I have extended MapKit's ability to draw custom annotation images with the following code:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
NSLog(@"Drawing a cloud on the map");
MKAnnotationView *view;
if(annotation != mapView.userLocation){
view=[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"parkingloc"];
view.image=[UIImage imageNamed:@"placemarkCloud.png"];
[view setCanShowCallout:YES];
[view setRightCalloutAccessoryView:[UIButton buttonWithType:UIButtonTypeDetailDisclosure]];
}
else{
view=
}
return view;
}
My question is what should I make view = to in order to retain the iPhone's built in blue dot. You can see that I eliminate my custom image being drawn for the dot, but I don't know how to make it show as default.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要在其他地方放任何东西。我进行以下检查。我认为这是来自苹果示例代码。
Don't put anything in the else. I do the following check. I think this is derived from Apple sample code.