2011-11-09 10 views
0

ここでは本当に奇妙な問題です。MapViewは最大3つの注釈を表示します

私は4つの注釈(または15、または20、私は何度も試してみました)を追加し、マップ上に2つまたは最大3つしか表示されません(ランダムなもの)。ここ

はソースです:

// [self showRealEstates]; 
    CLLocationCoordinate2D theCoordinate1; 
    theCoordinate1.latitude = 37.786996; 
    theCoordinate1.longitude = -122.419281; 

    CLLocationCoordinate2D theCoordinate2; 
    theCoordinate2.latitude = 37.810000; 
    theCoordinate2.longitude = -122.477989; 

    CLLocationCoordinate2D theCoordinate3; 
    theCoordinate3.latitude = 37.760000; 
    theCoordinate3.longitude = -122.447989; 

    CLLocationCoordinate2D theCoordinate4; 
    theCoordinate4.latitude = 37.80000; 
    theCoordinate4.longitude = -122.407989; 

    MapAnnotationRealEstate* myAnnotation1=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate1 andTitle:@"Rohan"]; 

    MapAnnotationRealEstate* myAnnotation2=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate2 andTitle:@"Vaibhav"]; 

    MapAnnotationRealEstate* myAnnotation3=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate3 andTitle:@"Rituraj"]; 

    MapAnnotationRealEstate* myAnnotation4=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate4 andTitle:@"Sahil"]; 

    NSMutableArray * annotations = [[NSMutableArray alloc] init]; 
    [annotations addObject:myAnnotation1]; 
    [annotations addObject:myAnnotation2]; 
    [annotations addObject:myAnnotation3]; 
    [annotations addObject:myAnnotation4]; 

    [mapView addAnnotations:annotations]; 
// [mapView addAnnotation:myAnnotation1]; 
// [mapView addAnnotation:myAnnotation2]; 
// [mapView addAnnotation:myAnnotation3]; 
// [mapView addAnnotation:myAnnotation4]; 

    NSLog(@"annotations: %d", [mapView annotations].count); 

最後のログはまだなって、他の要因を排除するために同じくらい私ができるように何をするか分からない、例を簡素化する2、または3を示していますこの。

答えて

0

私たちはこれらの2つの緯度/経度がかなり近いことがわかります。私はすべての注釈がマップ上にプロットされていると信じて、あなたは現在のズームレベルから見ることができません。

CLLocationCoordinate2D theCoordinate1; 
theCoordinate1.latitude = 37.786996; 
theCoordinate1.longitude = -122.419281; 

CLLocationCoordinate2D theCoordinate4; 
theCoordinate4.latitude = 37.80000; 
theCoordinate4.longitude = -122.407989; 

ズームアウトされたビューでは、マップビューでオーバーレイされているようです。 マップを最大レベルに拡大しよう& 4つの注釈がすべて表示されると思います。

とするか、これらのアノテーションの緯度/経度を変更してみることができます。

+0

これはかなり近いですが、見た目には十分です。私が地図の中を前後に行くと、私は4つの注釈のうち3つを見ることができますが、必ずしも同じではありません。そして、4つの注釈の間には十分な違いがあります。 – Danail

+0

そして私が言ったように、私はもっと多くの注釈でそれを試しましたが、私はいつもそれらの3つ(ランダム)が表示されます。 – Danail

+0

マップキットデリゲートを扱ったコードを共有してください。 viewForAnnotationなど – samfisher

関連する問題