2012-11-08 37 views
0

我正在嘗試替換自定義引腳的標準引腳。在iOS 6中,以下代碼可以正常工作並完全替代它!UIMapView中的自定義引腳

static NSString* AnnotationIdentifier = @"AnnotationIdentifierDealer"; 
MKPinAnnotationView* pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease]; 
pinView.animatesDrop=YES; 
pinView.canShowCallout=YES; 

UIImageView *newPin = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newpin.png"]]; 
pinView.image = newPin.image; 

上面的代碼不會在iOS5的工作(它顯示了原始引腳)......我能夠在原始針添加圖像,不幸的是,這並不因爲自銷的形狀工作是不同的。我能夠通過以下代碼在ios 5中的引腳添加它:

UIImageView *newPin = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newpin.png"]]; 
[pinView addSubView:newPin]; 

我怎樣才能取代原來的引腳。它應該運行在iOS5 + 6上

回答