Hiding native objects vs removing them. Is this ok?

Hi, 

I’m working on a mapView app which shows bunch of markers and then when a marker is tapped it goes to a detail view for that marker. I implemented a simple storyboard approach, one scene with the map and other scene with the detail view. So far so good.

Initially I set it such that the map would be removed before going to the detail view. That also meant each time the user wants to go back and look at another marker the map had to be re-created which was very time consuming… AKA slow app syndrome! Not good.

So I decided to try something different. I am now hiding the map using map.alpha = 0 on the exitScene() and then going to the detail view scene. On return to the map scene I simply reverse the visibility using map.alpha = 1. I don’t reload or recreate the map each time so in theory I think I should be fine. 

I know that Corona SDK display objects can’t be positioned over native objects such as mapView or webView etc but when the native objects are hidden the Corona SDK display objects seem to show well. 

I’m just wondering if I’m overlooking any issues with this approach. Is this method safe to use? 

Thank you very much for your guidance.

Regards,

Kerem

That should work.  If your touches are passing through, all should be good.  You could also move it off screen too.

Rob

Super. Thanks for the idea to move off screen. The detail view is mostly info only but there will be some buttons on it which need to be able to get focus. It needed I will move the map away to get the buttons in front. Appreciate your help.

Interesting finding. I did not need to move the map offscreen on IOS and the buttons on next screen were getting focus but on Android there aren’t so moving off screen is the way to go. Thanks once again for the hint. 

That should work.  If your touches are passing through, all should be good.  You could also move it off screen too.

Rob

Super. Thanks for the idea to move off screen. The detail view is mostly info only but there will be some buttons on it which need to be able to get focus. It needed I will move the map away to get the buttons in front. Appreciate your help.

Interesting finding. I did not need to move the map offscreen on IOS and the buttons on next screen were getting focus but on Android there aren’t so moving off screen is the way to go. Thanks once again for the hint. 

Thanks for pinning this down (no pun intended! :-). Hope it gets sorted out soon and that we can drive our battery usage down a little. 

Thanks for pinning this down (no pun intended! :-). Hope it gets sorted out soon and that we can drive our battery usage down a little.