AGSMapView and .locationDisplay state

844
3
02-27-2017 01:55 PM
WorthSparks
New Contributor III

My app instantiates an AGSMapView that gets covered and re-shown (using UINavigationController in a typical fashion). While the mapView is showing, the user toggles locationDisplay on and off using a button that calls mapView.locationDisplay's start() and  stop(). This works fine. If locationDisplay is ever started and then stopped before progressing to another view controller (covering the mapView), locationDisplay appears to restart when the user returns to the mapView. Upon debug inspection, properties inside mapView.locationDisplay look correct. In particular, mapView.locationDisplay.started == false.

My solution is to use mapView.locationDisplay's boolean properties showLocation, showAccuracy, and showAnimationSymbol to manually force it to not show when locationDisplay is stopped. But why do I only have to do this when reshowing the mapView after it was covered?

Tags (1)
0 Kudos
3 Replies
RyanOlson1
Esri Contributor

I have not seen this and I'm surprised at this behavior. Are you sure that there isn't somehow a second mapView being displayed? Maybe one was added during viewDidAppear?

0 Kudos
WorthSparks
New Contributor III

The only MapView is the one provided by Main.storyboard and linked into the view controller via @IBOutlet. However, I think I found the problem. Some time back, for whatever reason, I used viewWillAppear() to instantiate mapView.map, and viewDidDisappear() to un-instantiate mapView.map. I left it that way even though I didn't need to. I just changed it back to the more normal pattern of instantiating the map during viewDidLoad() and then leaving it alone. The problem then disappeared.

I surmise from this that there must be something about re-instantiating mapView.map that triggers a temporary display of mapView.locationDisplay. But it would take a lot more testing to prove that.

Thanks.

0 Kudos
RyanOlson1
Esri Contributor

I just tested it and it sure is a bug. I will submit an issue.