gpt4 book ai didi

iphone - 更改引脚设计

转载 作者:可可西里 更新时间:2023-11-01 05:24:42 24 4
gpt4 key购买 nike

是否可以将 MKAnnotation pin 更改为我自己设计的 png?

enter image description here

最佳答案

覆盖这个并成为 MKMapViewDelegate 的委托(delegate)来实现覆盖方法。

- (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"];

自定义图片完成

关于iphone - 更改引脚设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7124028/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com