我已将图像更改为下图,UIButtonTypeDetailDisclosure
但问题是图像变为蓝色。我的问题在哪里?
- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation
{
*infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[infoButton setImage:[UIImage imageNamed:@"carcar.png"] forState: UIControlStateNormal];
pinView.rightCalloutAccessoryView = infoButton;
}
最后更新:解决了最后一个 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;