0
iPhone에서 주석 달기 버튼 색상을 변경하는 방법은 무엇입니까?
위의 파란색 설명 선 단추를 회색으로 변경하고 싶습니다. 이 작업을 수행하는 방법 ?? 전체 주석 풍선을 클릭 할 수도 있습니다. 아무도 나에게 메서드를 제안 할 수 있습니다. 당신이 사용자 정의 버튼을 원하는 경우
iPhone에서 주석 달기 버튼 색상을 변경하는 방법은 무엇입니까?
위의 파란색 설명 선 단추를 회색으로 변경하고 싶습니다. 이 작업을 수행하는 방법 ?? 전체 주석 풍선을 클릭 할 수도 있습니다. 아무도 나에게 메서드를 제안 할 수 있습니다. 당신이 사용자 정의 버튼을 원하는 경우
당신은 아마 당신이 대신 UIButtonTypeDetailDisclosure
의 UIButtonTypeCustom
을 추가하고 프레임을 설정할 수 있습니다,이
- (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;
}
처럼 파란색 버튼 뭔가를 추가.
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; –
Ok ... CGRectMake (0, 0, 23, 23); 이 작동하지만 첫 번째 위치에 이미지가 표시되지 않습니다. 아무것도 남아 ??? –
나는 당신이 말한 것처럼 행동했지만 내 단추 이미지가 표시되지 않습니다. 버튼 위치를 클릭 한 후에 만 표시됩니다. 팝업 제목 및 하위 제목에만 표시됩니다 ......이 문제를 해결하기 위해 무엇입니까 ?? –