2011-12-19 2 views

답변

1

당신은 아마 당신이 대신 UIButtonTypeDetailDisclosureUIButtonTypeCustom을 추가하고 프레임을 설정할 수 있습니다,이

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{ 
MKPinAnnotationView *annView=(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"annViewIdentifier"]; 

    if (annView == nil) { 
     annView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annViewIdentifier"] autorelease]; 
    } 
UIButton *infoDefaultButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 

     [infoDefaultButton addTarget:self 
         action:@selector(showDetails:) 
      forControlEvents:UIControlEventTouchUpInside]; 
     annView.rightCalloutAccessoryView = infoDefaultButton; 

} 

처럼 파란색 버튼 뭔가를 추가.

+0

annView.image = [UIImage imageNamed : @ "flag.png"]; \t \t annView.annotation = annotation; UIButton * rightButton = [UIButton buttonWithType : UIButtonTypeCustom]; \t NSInteger annotationValue = [self.annobjs indexOfObject : annotation]; rightButton.frame = CGRectMake (5, 100, 10, 10); rightButton.tag = annotationValue; \t UIImage * grayImage = [UIImage imageNamed : @ "arrow.png"]; [rightButton setBackgroundImage : grayImage forState : UIControlStateHighlighted]; [rightButton addTarget : self 액션 : @selector (showDetails :) forControlEvents : UIControlEventTouchUpInside]; annView.rightCalloutAccessoryView = rightButton; –

+0

Ok ... CGRectMake (0, 0, 23, 23); 이 작동하지만 첫 번째 위치에 이미지가 표시되지 않습니다. 아무것도 남아 ??? –

+0

나는 당신이 말한 것처럼 행동했지만 내 단추 이미지가 표시되지 않습니다. 버튼 위치를 클릭 한 후에 만 ​​표시됩니다. 팝업 제목 및 하위 제목에만 표시됩니다 ......이 문제를 해결하기 위해 무엇입니까 ?? –

관련 문제