The map view shows the user's location with a default blue bubble animation. How can I change that default blue color to another color?
地图视图使用默认的蓝色气泡动画显示用户的位置。如何将默认蓝色更改为其他颜色?
2 个解决方案
#1
12
You can change the tintColor
of the mapView
with:
您可以使用以下命令更改mapView的tintColor:
mapView.tintColor = UIColor.greenColor()
Put this in the viewDidLoad()
of the ViewController
where your mapView
is embedded.
将它放在嵌入了mapView的ViewController的viewDidLoad()中。
#2
0
In swift 3 try with color literal
在swift 3中尝试使用color literal
mapView.tintColor = #colorLiteral(red: 0.9607843137, green: 0.5764705882, blue: 0.003921568627, alpha: 1)
#1
12
You can change the tintColor
of the mapView
with:
您可以使用以下命令更改mapView的tintColor:
mapView.tintColor = UIColor.greenColor()
Put this in the viewDidLoad()
of the ViewController
where your mapView
is embedded.
将它放在嵌入了mapView的ViewController的viewDidLoad()中。
#2
0
In swift 3 try with color literal
在swift 3中尝试使用color literal
mapView.tintColor = #colorLiteral(red: 0.9607843137, green: 0.5764705882, blue: 0.003921568627, alpha: 1)