I changed the image UIButtonTypeDetailDisclosureto the image below, but the problem is that the image turns blue. Where is my problem?
- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation
{
*infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[infoButton setImage:[UIImage imageNamed:@"carcar.png"] forState: UIControlStateNormal];
pinView.rightCalloutAccessoryView = infoButton;
}


Last update: Solved using the latest infoButton.frame.
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *carImage = [UIImage imageNamed:@"carcar.png"];
if ([carImage respondsToSelector:@selector(imageWithRenderingMode:)])
{
carImage = [carImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
[infoButton setImage:carImage forState: UIControlStateNormal];
infoButton.frame = CGRectMake(0, 0, 32, 32);
pinView.rightCalloutAccessoryView = infoButton;
source
share