GMSPanoramaView - change the location point and the camera fields at the same time

812 Views Asked by At

I'm having in my app a GMSPanoramaView witch contains some street view images. I want to change those images to several locations with different 'heading' - directions.

I can't see a way to update the view with the new location, and the new heading at the same time.

The only way I can see is updating the location (by moveNearCoordinate func) and only after the camera's heading (by updateCamera: func).

But this way cause a 'jump' in the seeing image - the view presenting the new location, and than jumping to the wanted heading. (the same will happens if i will update the camera first, and than the location).

I want the view to present the new location with specific direction Immediately. I will be happy for some solution. thanx.

2

There are 2 best solutions below

0
On

You should make your heading changes in this method given to you by the GMSPanoramaViewDelegate

- (void)panoramaView:(GMSPanoramaView *)view
   didMoveToPanorama:(GMSPanorama *)panorama
      nearCoordinate:(CLLocationCoordinate2D)coordinate

In this method, you should only call self.view = self.panoramaView; after you've changed the heading by updating the camera. This is how I fixed a similar issue I was facing with the setting the heading of the panoramaView.

0
On
    func panoramaViewDidFinishRendering(_ panoramaView: GMSPanoramaView) {

        if (flag_init){
        flag_init = NO
       panoramaView.camera = GMSPanoramaCamera(heading: 180, pitch: 1, zoom: 1)
        panoramaView.alpha = 1
}
    }

i can't find how can do it but can minimize the time , of course you can modify the code to make sure the alpha value become 1 for second finish rendering