iOS GoogleMaps SDK - animateToCameraPosition animation finished handler?

后端 未结 5 1885
离开以前
离开以前 2021-02-19 14:54

Currently I am using the GoogleMaps SDK for iOS for various operations. When calling

[self.googleMapsView animateToCameraPosition:[GMSCameraPosition 
                  


        
5条回答
  •  天涯浪人
    2021-02-19 15:22

    This might work (I haven't tried it):

    [CATransaction begin];
    [CATransaction setValue:[NSNumber numberWithFloat: 1.0f] forKey:kCATransactionAnimationDuration];
    [self.googleMapsView animateToCameraPosition:[GMSCameraPosition 
                            cameraWithLatitude:LATITUDE
                                     longitude:LONGITUDE
                                          zoom:ZOOM]];
    [CATransaction setCompletionBlock:^{
        // ... whatever you want to do when the animation is complete
    }];
    [CATransaction commit];
    

    Basically, this creates an animation transaction that animates your camera movement (change the value for numberWithFloat: to change the speed) and you set your own completion block stating what you want to do when the animation is over. [CATransaction commit] is what fires the animation off.

    Note: this answer partially based off this answer.

提交回复
热议问题