나는 최근에 this website을 보았습니다. 이미지에서 버튼을 보도록 전화를 걸었습니다.MKMapView에 액세서리보기 버튼을 추가하면 주석을 불러 낼 수 있습니까?
웹 사이트 예제의 코드는 정상적으로 작동하지만 동일한 코드를 프로젝트에 추가하려고하면 동일한 결과가 나타나지 않습니다.
내가 놓친 부분이 분명 있지만이 부분을 해결할 수는 없습니다.
여기에 주석 내 코드입니다 :
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
annView.pinColor = MKPinAnnotationColorGreen;
UIButton *advertButton = [UIButton buttonWithType:UIButtonTypeCustom];
advertButton.frame = CGRectMake(0, 0, 23, 23);
advertButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
advertButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[advertButton setImage:[UIImage imageNamed:@"button_right.png"] forState:UIControlStateNormal];
[advertButton addTarget:self action:@selector(showLinks:) forControlEvents:UIControlEventTouchUpInside];
annView.rightCalloutAccessoryView = advertButton;
annView.animatesDrop=TRUE;
annView.canShowCallout = YES;
annView.calloutOffset = CGPointMake(-5, 5);
return annView;
}
어떤 도움을 주시면 감사하겠습니다! :)
을, 당신이 제공 한 링크가 죽었습니까 –