私は、位置座標やその他のカスタム注釈に基づいて現在の位置を表示するMKMapビューに取り組んでいます。Iphone 3gsでは正しく表示されますが、iphone 4.0以降では、毎回カスタム注釈が表示されるわけではありません(ランダムに緑色のピンのみが表示され、他のピンは表示されません)。何が問題になる可能性がありますか?iOS 4.0以降に問題はありますか?もしそうなら、どうすればそれを解決できますか?誰かが私を助けることができます
ありがとう
viewForAnnotationメソッドからのコード...
if ([annotation isMemberOfClass:[MKUserLocation class]])
{
return nil;
}
if (annotation==self.normalAnnotation)
{
NSLog(@"green pin");
MKPinAnnotationView *annotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"NormalAnnotation"] autorelease];
annotationView.canShowCallout = NO;
annotationView.pinColor = MKPinAnnotationColorGreen;
return annotationView;
}
else
{
NSLog(@"Custom pin");
Marker *obj = [database getMarkerWithName:[annotation title]];
MKAnnotationView *newAnnotation=[[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"]autorelease];
newAnnotation.image = [UIImage imageNamed:obj.markerImage];
newAnnotation.canShowCallout=YES;
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[button addTarget:self action:@selector(checkButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
[button setTag:obj.markerID];
newAnnotation.rightCalloutAccessoryView=button;
//annotation.annotationObj = newAnnotation;
return newAnnotation;
}