0

マップキットでカスタムアノテーションビューを追加しようとしています。赤い注釈ピンをタップすると、注釈コールアウトが表示されますが、それは非常に簡単です。私がストーリーボードに作成したカスタムビューを追加したいと思います。 ビデオやテキストのチュートリアルのリンクや、それに関する他の種類のヘルプを私に提供してもらえますか?ios MapKitでストーリーボードを使用するカスタムアノテーションビュー

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{ 

    if([view isKindOfClass:[MKUserLocation class]]){ 

     return ; 
    } 

    CLLocationCoordinate2D optimusInfoCallOut = CLLocationCoordinate2DMake(28.625551, 77.373268); 

    [self.mapView setRegion:MKCoordinateRegionMakeWithDistance(optimusInfoCallOut, 800, 800)animated:YES]; 

    UIImageView *imgView =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"loc.png"]]; 

    CGRect calloutViewFrame = imgView.frame; 
    imgView.frame = CGRectMake(calloutViewFrame.size.width/8.0, calloutViewFrame.size.height-24, 200, 100); 

    CustomPointAnnotation *cpa = [[CustomPointAnnotation alloc] init]; 
    cpa.name = @"OpTi"; 
    cpa.imgName1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"loc.png"]]; 
    self.customCallOutDetailsView.name.text = cpa.name; 
    self.customCallOutDetailsView.callImage = cpa.imgName1; 

    [self.view addSubview:self.customCallOutDetailsView]; 
} 

マイcustomCallOutDetailViewが注釈をタップに表示されているが、それはその注釈ピンポイントで表示されていないです、私は、ビューは、ビューの原点からその座標を取っていると思います。

答えて

0

この方法では、カスタム表示を追加できます。次のリンクに

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{ 

[view addSubview:customView]; 
} 

詳細情報: How To add custom View in map's Annotation's Callout's

+0

yup..Itの作業 –

+0

私は、カスタムlocation.Itは、地図の右上隅に表示されて、ピンポイントで呼び出す見ることができません。それについては 助けてもらえますか?コードを投稿しました。 –

+0

customView.center = CGPointMake(view.bounds.size.width * 0.5f、-self.visibleCalloutView.bounds.size.height * 0.5f); –

関連する問題