多くのアノテーションを付けてMKMapViewを使用しています。ズームインしてマップをズームアウトするまではすべて問題ありません。いくつかのアノテーションの位置は、お互いに切り替わります。誰でも知っている理由は? ここで私のコードはviewDidLoadの後に、3つの配列からアノテーションをインポートするコードです:経度、緯度、およびフォトファイル名。 photoFileNameには、すべての注釈の写真ファイル名が含まれています。経度と緯度にはそれらの座標が含まれています。ズームイン/ズームアウト後にMKMapviewアノテーションが正しく処理されない
for (int i=0; i<[longitudes count]; i++)
CLLocation* location = [[CLLocation alloc] initWithLatitude:[latitudes objectAtIndex:i]
longitude:[longitudes objectAtIndex:i]];
CSMapAnnotation* annotation = [[CSMapAnnotation alloc] initWithCoordinate:[location coordinate]
annotationType:CSMapAnnotationTypeImage
title:@"";
subtitle:@"";
// Set data for the annotation. This data is used for displaying annotation
[annotation setUserData:[photoFilename objectAtIndex:i]];
[_mapView addAnnotation:annotation];
[annotation release];
[currentLocation release];
}
OKロードはすべて、働いスクロールやズーム。ただし、マップビューをズームイン(約5〜10倍大きく)した後、再び最初のサイズにズームアウトすると、一部のアノテーションの場所が変更されます(下の注釈を参照)。 関数viewForAnnotationは呼び出されていないのでここには投稿しません。私はズームイン/アウトしているだけです。 http://cC8.upanh.com/27.800.35078007.mF80/1.pnghttp://cC9.upanh.com/27.800.35078008.AWG0/2.png
viewForAnnotation:は決して呼び出されませんか?私はそれがannotationViewsを再利用することによって引き起こされると思います。 – ender
ああ、そうです。もう一度viewForAnnotation関数を見て、問題を解決しました。ここに私の古いコードはありますか: – toandk
あなたの質問を更新し、それをどう修正したのかを示すべきでしょう。 – ender