내 코드는 - (MKAnnotationView *) mapView : (MKMapView *) mapView viewForAnnotation : (id) 주석 방법입니다. 메서드가 호출되고 있지만 pinView.animatesDrop = YES 및 pinView.canShowCallout = YES가 작동하지 않습니다.iphone pinView.animatesdrop not working
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@","];
NSLog(@"pin map");
if(pinView == nil)
{
pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@""];
pinView.animatesDrop = YES;
pinView.canShowCallout = YES;
UIImage *image = [UIImage imageNamed:@"ann.png"];
CGRect resizeRect;
resizeRect.size = image.size;
CGSize maxSize = CGRectInset(self.view.bounds,
[map annotationPadding],
[map annotationPadding]).size;*/
maxSize.height -= self.navigationController.navigationBar.frame.size.height + [map calloutHeight];
if (resizeRect.size.width > maxSize.width)
resizeRect.size = CGSizeMake(maxSize.width, resizeRect.size.height/resizeRect.size.width * maxSize.width);
if (resizeRect.size.height > maxSize.height)
resizeRect.size = CGSizeMake(resizeRect.size.width/resizeRect.size.height * maxSize.height, maxSize.height);
resizeRect.origin = (CGPoint){0.0f, 0.0f};
UIGraphicsBeginImageContext(resizeRect.size);
[image drawInRect:resizeRect];
UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
pinView.image = resizedImage;
pinView.opaque = NO;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView = rightButton;
if (annotation == mapView.userLocation)
{
return nil;
}
return pinView;
}
else
{
pinView.annotation = annotation;
}
return pinView;
}
이 질문/답변은 다른 사람에게 유용 할 수 있습니까? 그렇지 않다면 삭제하는 것이 좋습니다. – Benjol
예, 유용 할 수 있습니다. 그처럼 단순하지만 사소한 일들을 놓치지 않으려 고 – Droidme
ok, 어느 것이 올바른 대답인지,이 하나입니까, 아니면 @ Mayur입니까? 그것이 그의 것이라면, 나는 당신의 고백을 그의 대답에 대한 논평으로두고 이것을 삭제할 것을 제안 할 것입니다. – Benjol