ios - 带有灰色箭头按钮的标注附件 View ,而不是蓝色 'i' 按钮

标签 ios mkmapview mkannotationview

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

        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 中定义的所有按钮类型,但没有成功。

最佳答案

获取箭头图像并将其设置在标注附件 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/

相关文章:

ios - 快速在单个 Storybord 中使用 2 个不同的 UICollectionView

ios - 如何在 Obj C 中编写没有完成 block 的异步方法的单元测试

objective-c - 从引用 NSDate 获取下一周的 NSDate?

iphone - 检测哪个 MKAnnotation 标注被触摸

swift - 集群在 iOS 13 中无法正常工作

ios - 在多个地方显示相同图像的正确 Firebase 设计是什么

ios - mapView 区域纬度和经度增量减少每次搜索

ios - MKMapView隐藏 basemap 图层

ios - map 缩放时,图钉上的弹出框不会移动

ios - 可拖动图钉在 map 上没有固定位置