HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – UIButtonTypeDetailDisclosure颜色变化大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已将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,32,32);

    pinView.rightCalloutAccessoryView = infoButton;

解决方法

@H_197_17@ 使用自定义按钮类型:

infoButton = [UIButton buttonWithType:UIButtonTypeCustom];

如果要添加自己的图像,则应始终使用此方法.其他类型用于预定义按钮(如信息,添加联系人等)

大佬总结

以上是大佬教程为你收集整理的ios – UIButtonTypeDetailDisclosure颜色变化全部内容,希望文章能够帮你解决ios – UIButtonTypeDetailDisclosure颜色变化所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。