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