gpt4 book ai didi

ios - UIButtonTypeDetailDisclosure 颜色变化

转载 作者:可可西里 更新时间:2023-11-01 05:29:44 26 4
gpt4 key购买 nike

我已将 UIButtonTypeDetailDisclosure 的图像更改为下图,但问题是图像变成了蓝色。我的问题在哪里?

- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation
{
*infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

[infoButton setImage:[UIImage imageNamed:@"carcar.png"] forState: UIControlStateNormal];

pinView.rightCalloutAccessoryView = infoButton;
}

enter image description here

enter image description here

最后更新:用最后一个 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;

最佳答案

我遇到了类似的问题并按如下方式解决(使用您的代码):

UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[infoButton setTintColor:[UIColor clearColor]];

UIImage *carImage = [[UIImage imageNamed:@"carcar.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

[infoButton setBackgroundImage:carImage forState:UIControlStateNormal];

关于ios - UIButtonTypeDetailDisclosure 颜色变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19957331/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com