Is there any way to show some text on top of AGSPictureMarkerSymbol ?

398
1
07-17-2023 04:51 AM
Tarak-Kar
New Contributor III

I am using AGSPictureMarkerSymbol to show marker with image. I want to add the text above the image marker. Is there any way to achieve this? 

1 Reply
Ting
by Esri Contributor
Esri Contributor

You can use an AGSCompositeSymbol for this purpose, to combine an image symbol and a text symbol. Below is an example to overlay an index number on top of a blue marker image.

let markerImage = UIImage(named: "BlueMarker")!
let markerSymbol = AGSPictureMarkerSymbol(image: markerImage)
markerSymbol.offsetY = markerImage.size.height / 2
let textSymbol = AGSTextSymbol(text: "1", color: .white, size: 20, horizontalAlignment: .center, verticalAlignment: .middle)
textSymbol.offsetY = markerSymbol.offsetY
let compositeSymbol = AGSCompositeSymbol(symbols: [markerSymbol, textSymbol])

 

0 Kudos