[英]Problem with MKAnnotation image property in Objective-C
我正在實現一個基於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];
您還需要設置注釋位置。 默認(0,0)的位置確實在海洋中;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.