带灰色箭头按钮的标注配件视图不是蓝色'i'按钮

时间:2014-07-21 15:58:02

标签: ios mkmapview mkannotationview

我看到很多关于如何将标注附件视图添加到注释的示例:

        UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
        [rightButton addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
        annotationView.rightCalloutAccessoryView = rightButton;

然而,这给了我一个蓝色信息按钮:

enter image description here

但我真的想要灰色箭头按钮:

enter image description here

有没有办法从SDK中获取此类按钮。我尝试了UIButton中定义的所有按钮类型,但没有运气。

1 个答案:

答案 0 :(得分:3)

获取箭头图像并将其设置在标注附件视图中

UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[rightButton setImage:[UIImage imageNamed:@"abc.png"] forState:UIControlStateNormal];
[rightButton setImage:[UIImage imageNamed:@"abc.png"] forState:UIControlStateHighlighted];
[rightButton addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;