0
어쩌면 5 개의 주석 (현재)이있는 MKMapview가로드되어 있습니다. 주석은 잘로드됩니다. 각 주석은 올바른 왼쪽 및 오른쪽 설명 선을 포함합니다. 그러나 잠시 후에 (아마 2 분) 나는 종종 내가 어쩌면 내 응용 프로그램은 여전히 주석을로드하려고 생각하고있다} ... 주석의 왼쪽 선에,iphone mkannotation :지도가로드 된 후 왼쪽 설명 선의 경고
을
- (MKAnnotationView *) mapView:(MKMapView *)thisMapView
viewForAnnotation:(MapAnnotations *)annotation
{
static NSString *MapIdentifier = @"MapIdentifier";
UIImageView *myImageView;
MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[thisMapView dequeueReusableAnnotationViewWithIdentifier:MapIdentifier];
if(annotationView == nil)
{
NSString * id = [NSString stringWithFormat:@"%d", (annotation).tag];
NSString * postPhoto = [NSString stringWithFormat:@"id=%@",id];
NSString * hostStrPhoto = @"http://domain.com/get_image.php?";
hostStrPhoto = [hostStrPhoto stringByAppendingString:postPhoto];
NSData *imgData = [NSData dataWithContentsOfURL:[NSURL URLWithString:hostStrPhoto]];
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageWithData: imgData]];
myImageView.frame = CGRectMake(0,0,31,31);
annotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:MapIdentifier] autorelease];
}
annotationView.animatesDrop=TRUE;
annotationView.canShowCallout = YES;
annotationView.leftCalloutAccessoryView = myImageView; //<--where I am getting the error, after all the annotations have loaded.
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
return annotationView;
[myImageView autorelease];
을 EXC_BAD_ACCESS 충돌을 얻을 , 그러나 나는 이유를 이해할 수 없다. 지도가로드 될 때 일부 메모리 경고가 발생하므로, 내가해야하는 방식으로 일부 객체를 릴리스하지 않을 것입니다. 메모리 관리가 작동하는 방식에 대해 여전히 새로운 것이므로 어떤 제안이라도 도움이 될 것입니다.
지금은 상당히 잘 작동합니다. 지금까지 충돌 없음 :) – amanda