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が注釈をタップに表示されているが、それはその注釈ピンポイントで表示されていないです、私は、ビューは、ビューの原点からその座標を取っていると思います。
yup..Itの作業 –
私は、カスタムlocation.Itは、地図の右上隅に表示されて、ピンポイントで呼び出す見ることができません。それについては 助けてもらえますか?コードを投稿しました。 –
customView.center = CGPointMake(view.bounds.size.width * 0.5f、-self.visibleCalloutView.bounds.size.height * 0.5f); –