2012-01-31 4 views
0

서버에서 데이터를 가져 와서 맵의 다른 집을 찾아내는 앱을 만들고 있습니다. 내가하여 배열 내 주석을 넣어 (MKAnnotationView *)보기MKMapAnnotations didSelectAnnotationView 응답이 없습니다

: (MKMapView *)지도보기 didSelectAnnotationView : (무효)지도보기 - 내 문제는 주석을 표시 않지만 내가 그들 클릭하면 그들은 응답하지 않는다는 것입니다 :

int s; 
self.mapAnnotations = [[NSMutableArray alloc] init]; 

for(s=0; s < numberOfAnnotations; s++) 
{ 
    //NSDictionary *dict2 = [parser objectWithString:[[arrayOfResults objectAtIndex:0] description]]; 

    CLLocationDegrees daLong = [[[[[arrayOfResults objectAtIndex:s] objectForKey:@"map"] objectForKey:@"longitude"] description] floatValue]; 
    CLLocationDegrees daLat = [[[[[arrayOfResults objectAtIndex:s] objectForKey:@"map"] objectForKey:@"latitude"] description] floatValue]; 

    /*self.customAnnotation = [[BasicMapAnnotation alloc] initWithLatitude:daLat andLongitude:daLong]; 
    [self.mapView addAnnotation:self.customAnnotation];*/ 

    BasicMapAnnotation *m = [[BasicMapAnnotation alloc] initWithLatitude:daLat andLongitude:daLong]; 
    [self.mapAnnotations addObject:m]; 


} 

[self.mapView addAnnotations:self.mapAnnotations]; 
NSLog(@"this number of annotations %d", [self.mapAnnotations count]); 

내가있는 viewDidLoad에서지도를 배치하기 위해 별도의 집을 만들 때 나는 또한 발견 :

내가 클릭 만하면 작동을 배열을 통과 한 사람 didn를 않았다
self.normalAnnotation = [[BasicMapAnnotation alloc] initWithLatitude:38 andLongitude:-90.2045]; 
self.normalAnnotation.title = @"               "; 
[self.mapView addAnnotation:self.normalAnnotation]; 

일하지 마라. 아무도 응답하지 않는 이유를 알아낼 수 있습니까?

답변

4

설명 문구를 표시하려면 주석에 title이 있어야하기 때문입니다. for 루프에서 self.normalAnnotation.title = @" "과 같이 title 속성을 설정하십시오.

+2

감사합니다. 나는 그것이 전혀 문제가 될 것이라고 생각하지 않았다 !! – bakwarte

관련 문제