0

MKAnnotationView をサブクラス化して、デフォルトの注釈画像を別のものに変更しています。これは IOS4 では正常に機能しましたが、IOS6 用にコンパイルして実行しようとすると、次のエラー メッセージが表示されます。

[MKPinAnnotationView setImageForAnnotationWithType:]: 認識されないセレクターがインスタンス 0x25936400 に送信されました

setImageForAnnotationWithType はもちろん定義されています。私には、annotationView オブジェクトを正しくキャストできないようです。

次の行を使用して注釈オブジェクトを取得します。

LAnnotationView *anotationView = [_mapView viewForAnnotation:anotation];

この行は、オブジェクトをキャストして返す次のメソッドを呼び出します。

-  (LAnnotationView *) viewForAnnotation:(Annotation *)annotation
{
    LAnnotationView *resultView = (LAnnotationView *) [_mapView viewForAnnotation:annotation];
    return resultView;
}

オブジェクトを返した後、失敗した実際のメソッドを呼び出します。

[anotationView setImageForAnnotationWithType:LMapAnnotationGreenArrow];

isKindOfClass を使用してクラス タイプを確認しようとしましたが、これも失敗します。ここで何が間違っている可能性がありますか?前述のように、以前のバージョンの IOS では問題なく動作しました。

4

0 に答える 0