我看到很多关于如何将标注附件视图添加到注释的示例:
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[rightButton addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
然而,这给了我一个蓝色信息按钮:
但我真的想要灰色箭头按钮:
有没有办法从SDK中获取此类按钮。我尝试了UIButton中定义的所有按钮类型,但没有运气。
答案 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;