How to rotate a graphic swift with the map/device.

471
3
Jump to solution
01-14-2020 09:32 AM
by Anonymous User
Not applicable

Hi,

I have a vehicle graphic on the map, but when I rotate my device/map the rotation of the ArcGraphic is off. Is there a best practiced way to do this in swift?

thanks.

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Aha. I think you're thinking of angleAlignment on AGSMarkerSymbol (guessing you're using AGSPictureMarkerSymbol which is a subclass). Set that to .map.

If you're using a renderer you can also use the rotationExpression. That way you can just update an attribute on each graphic as needed and the renderer will take care of everything else.

View solution in original post

0 Kudos
3 Replies
Nicholas-Furness
Esri Regular Contributor

Can you explain your question a bit more please?

For example: Do you want the graphic's symbol to point in the direction that your device is pointing? Does the graphic represent your location, or that of some other vehicle?

0 Kudos
by Anonymous User
Not applicable

Like an uber app for instance, I have the veichle geo rotation in degrees let's say its going west and then I rotate the map while the graphic is pointing west the graphics rotation will get messed up since the map isn't pointing north anymore. I thought I seen a way to tie the rotation to the map in documentation a long time ago but haven't been able to find it since.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Aha. I think you're thinking of angleAlignment on AGSMarkerSymbol (guessing you're using AGSPictureMarkerSymbol which is a subclass). Set that to .map.

If you're using a renderer you can also use the rotationExpression. That way you can just update an attribute on each graphic as needed and the renderer will take care of everything else.

0 Kudos