简体   繁体   中英

Zoom Google Map from different ViewController - iOS

Scenario

I have a TabBarcontroller with 2 tabs.

I have GoogleMap's Map on ViewControllerA (Tab 1).

I'm currently on another view controller, let's say ViewControllerB (Tab 2), which has a UITableView , and obviously, the map is not visible here.

Problem

Now I call a function (via delegates) in ViewControllerA , to zoom the map to a particular location, but it doesn't zoom it until I switch back to Tab 1. (As soon as I switch to Tab 1, the map zooms to that location in an eye's blink.

Is there anyway to zoom the map without opening that Viewcontroller?

Please Help. Thanks.

I'd try using a singleton design pattern, basically create a singleton reference to the GoogleMap object and set the zoom and try:

[mapSingletonObjc setNeedsDisplay];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM