Selecting a graphic in AGSGraphicsOverlay

1212
5
05-19-2017 02:17 PM
NikolayYekimov1
New Contributor III

I am trying to migrate from iOS SDK 10.2.5 to 100.0.1 and having some questions. I read migration guide and checked examples on the github and still can't get how to select a graphic. 

First of all, how to specify a selectionSymbol. In 10.2.5 I used to set `AGSGraphicsLayer.selectionSymbol`, the AGSGraphicsOverlay doesn't have such property. It seems that now the layer isn't anymore responsible for graphics selection but still have a method `clearSelection()`.

So it looks like I should use `self.mapView.identify(AGSGraphicsOverlay, ...)` method on map touch and then run graphic.isSelected = true on the results. Is it a correct plan? And still how to specify a selection symbol? Or should I change the graphic.symbol each time?

0 Kudos
5 Replies
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Nikolay Yekimov,

Based on my test, it looks like in 100.0.0, when you identify the graphic, it doesn't means you selected it.

I use this method to check:

self.graphicsOverlay.selectedGraphics()

And it returns an empty array. So you have to call isSelected = true at this moment.

Here is the screenshot that illustrate the result:

0 Kudos
NikolayYekimov1
New Contributor III

Sounds good. So my assumption was correct.

And what is about specifying selection symbol? I want to use another symbol for a selected graphic, not a color but a graphic symbol. Do you have any ideas?

0 Kudos
DiveshGoyal
Esri Regular Contributor

We don't provide the ability to specify a selection symbol. If you want to use a different symbol for selected graphics, assign the selected graphics a new symbol, and revert the symbol back when you unselect them

0 Kudos
NikolayYekimov1
New Contributor III

sounds sad (

v 10.2.x had this ability...

MonteMango
New Contributor

sad (

0 Kudos