gpt4 book ai didi

ios - 更改 rightCalloutAccessoryView 的颜色

转载 作者:行者123 更新时间:2023-11-30 14:04:39 26 4
gpt4 key购买 nike

不知何故,我的 rightCalloutAccessoryView 不可见,这就是我的样子:

enter image description here

按钮位于右侧,但它是白色的。我如何改变它的颜色?据我所知,它通常应该是蓝色的。

这是我的代码:

func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
if !(annotation is CustomPointAnnotation) {
return nil
}

let reuseId = "test"

var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? MKPinAnnotationView
if anView == nil {
anView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
anView!.canShowCallout = true
anView!.calloutOffset = CGPoint(x: -5, y: 5)
anView!.rightCalloutAccessoryView = UIButton.buttonWithType(UIButtonType.InfoLight) as! UIView
}
else {
anView!.annotation = annotation
}

//Set annotation-specific properties **AFTER**
//the view is dequeued or created...

let cpa = annotation as! CustomPointAnnotation
anView!.image = UIImage(named:cpa.imageName)

return anView
}

最佳答案

啊,我找到了答案。我就是这样做的。

var calloutButton = UIButton.buttonWithType(.DetailDisclosure) as! UIButton
calloutButton.setImage(UIImage(named: "arrow-right.png"), forState: UIControlState.Normal)
calloutButton.tintColor = UIColor(red: CGFloat(51/255.0), green: 51/255, blue: 51/255, alpha: 1)

显然,我只需调用按钮“tintColor”即可。

关于ios - 更改 rightCalloutAccessoryView 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32565713/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com