是否有可能在MKAnnotation引脚改变我自己设计的PNG?更改PIN设计
Q
更改PIN设计
4
A
回答
4
覆盖这一点,并MKMapViewDelegate的委托来实现覆盖的方法。
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation;
创建注释,
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];// get a dequeued view for the annotation like a tableview
if (annotationView == nil)
{
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
}
annotationView.annotation = annotation;
annotationView.canShowCallout = YES; // show the grey popup with location etc
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
///[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
annoationView.image = [UIImage imageNamed:@"random.png"];
自定义图像进行
2
是的,在viewForAnnotation委托回调可以提供力所能及的观看你喜欢的。
1
对于自定义标注图像,设置图像属性,因为这样。
UIImage *annImage = [UIImage imageNamed:@"AnnotationIcon.png"];
annView.image = annImage;
请注意,MKPinAnnotationView animateDrop属性不会对自定义图像工作。有一种方法可以复制该动画。见How do I animate MKAnnotationView drop?
相关问题
- 1. 更改google地图中的pin标签?
- 2. iOS MapKit更改mapview maptype导致注释图像更改为pin?
- 3. 更改EditText的设计
- 4. 在设计时更改AppResources
- 5. 更改设计的sign_in url
- 6. 莲藕运行时设计更改
- 7. 更改Android微调器布局/设计
- 8. 更改默认路由设计的Rails
- 9. 更改材质设计AppCompat ActionBar颜色
- 10. 如何更改重定向的设计
- 11. html + css表格设计更改
- 12. 数据库设计更改JPA
- 13. Datatables表格工具设计更改?
- 14. 设计 - 更改路线的名称
- 15. 更改设计时的颜色菜单
- 16. 在设计中更改用户密码
- 17. 更改设计默认根目录
- 18. 如何更改UIBarButtonItem按钮设计?
- 19. Angular $ http更改网址在Rails设计
- 20. 离子更改默认下拉设计
- 21. stm32动态计时器设置更改
- 22. 更改设计结帐的Magento
- 23. 将更改的PIN写入卡的APDU命令
- 24. 如何将红色Pin更改为自定义图像? iOS
- 25. MKMapView如何更改用户最近位置的PIN图像?
- 26. 如何使用Android中的sharedpreferences更改PIN码?
- 27. Pin It按钮不显示计数
- 28. 改变Pin的颜色iOS MapKit
- 29. 问题设计审计表以跟踪更改
- 30. Java ME RS232通信。电源PIN设置