我看到很多关于如何向注释添加标注附件 View 的示例:
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[rightButton addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
然而,这给了我一个蓝色的信息按钮:
但我真的想要灰色箭头按钮:
有没有办法从SDK中获取这种类型的按钮。我尝试了 UIButton 中定义的所有按钮类型,但没有成功。
最佳答案
获取箭头图像并将其设置在标注附件 View 中
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;
关于ios - 带有灰色箭头按钮的标注附件 View ,而不是蓝色 'i' 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24869436/