Objective-C中MKAnnotation图像属性的问题

时间:2010-10-29 11:35:43

标签: iphone objective-c mkannotationview

我正在实现一个基于MKMapView的应用程序。因为我使用自定义图像而不是通过使用MKAnnotationView.Image属性显示引脚。

工作正常。但我在海洋中显示的针显示有问题。当我使用默认引脚时,它工作正常。我不知道是什么问题。

cityAnnotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"CityAnnotation"] autorelease]; 
//cityAnnotationView.image = [[UIImage imageNamed:@"city_pin.png"] stretchableImageWithLeftCapWidth:100 topCapHeight:10]; 
cityAnnotationView.image = [UIImage imageNamed:@"city_pin.png"];
cityAnnotationView.backgroundColor=[UIColor clearColor]; 
cityAnnotationView.annotation = annotation;
cityAnnotationView.canShowCallout = NO; 
cityAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

1 个答案:

答案 0 :(得分:0)

您还需要设置注释位置。 默认(0,0)位置确实在海洋中;)