2011-07-16 1 views
0

pinView CalloutiphoneのmkMapviewのAピンのカスタムコールアウト!私はピン用のカスタムコールアウト用にしようとしていますコールアウトおよびカスタム

を呼び出し、デフォルトのデータのミスマッチがMapViewの中に落とし.... ..私は、デフォルトのコールアウトを非表示にすることで、これを行うことができますよ私のカスタムコールをそこに表示しています。 ()..すべて正常に動作しています...しかし、probだけ私はコールの正しい情報を割り当てることができません..私は情報が私のカスタムコールアウトとは異なるデフォルトコールを示していた。私は、いずれかがこのAWREであればここで

は私のコードは

-(void)mapViewImplementaion 
{ 

    [mapview setMapType:MKMapTypeStandard]; 
    mapview.showsUserLocation=YES; 


    for (int i =0;i<[allResultsArr count];i++) 
    { 
     List_Map_details *object=[allResultsArr objectAtIndex:i]; 

     CLLocationCoordinate2D coordinat = {[object.lati floatValue], [object.longi floatValue]}; 

     [mapview setRegion:MKCoordinateRegionMake(coordinat, 
                 MKCoordinateSpanMake(0.027f, 0.027f))]; 



DisplayMapPark *ann = [[DisplayMapPark alloc] init]; 

     ann.title =[NSString stringWithFormat:@"%@",object.forRetailerName]; 
     ann.subtitle=[NSString stringWithFormat:@"%@ %@ %@",object.forAddress,object.forZipCode,object.forCityName]; 
     ann.latitude=[object.lati floatValue]; 
     ann.longitude=[object.longi floatValue]; 
     ann.coordinate = coordinat; 
     [mapview addAnnotation:ann]; 
     [ann release]; 



} 




CalloutMapAnnotationView *calloutMapAnnotationView; 

int m=1; 


-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation { 

    MKAnnotationView *pinView = nil; 



// here i wrote some code for my custom callout to generate(not shown) 


if(annotation != mapview.userLocation) 
    { 

     //int i=0; 
     static NSString *defaultPinID = @"com.invasivecode.pin"; 
     pinView = (MKAnnotationView *)[mapview dequeueReusableAnnotationViewWithIdentifier:defaultPinID]; 

if (pinView == nil) 
      pinView = [[[MKAnnotationView alloc] 
              initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease]; 


     NSString *imagName = [NSString stringWithFormat:@"%d.png", m]; 
     UIImage *image = [UIImage imageNamed:imagName]; 
     [pinView setImage:image]; 

     pinView.canShowCallout = NO; 
     // To show this in scrren Shot i set it to Yes; 


     [pinView setAnnotation:annotation]; 

     pinView.tag=m; 

     UIButton *rightButton=[UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
     pinView.rightCalloutAccessoryView=rightButton; 
     //pinView.rightCalloutAccessoryView.frame=CGRectMake(0, 0, 60, 60); 

     m++; 
    } 

    else 
    { 
     [mapview.userLocation setTitle:@"Ik ben hier"]; 


    } 

    pinView.annotation = annotation; 
    [rightButton release]; 
    return pinView; 

} 

こんにちはです..... scrrenショットを添付しまし..助けてください!!!!!

+0

ここにすべての関連コードがありますか?カスタムコールアウトコードが不足しているようですか? –

+0

こんにちは。うん、私は削除したカスタムポップアウトコード....そのピンlatiとlongi assingningの問題。 – Naren

+0

私たちが助けてくれるのは、そのコードが問題のどこにあるのか疑問に思っています。あなたが投稿した他のコードはOKです。 –

答えて

0

私はこの問題を解決しました。それは私の間違いでした。私はちょうどピンにタグを正しく割り当てていませんでした。ユーザーがピンを選択すると、私は他のピンの情報を読んでいました....ありがとうございました

関連する問題