Controlling Animation Duration in Google Maps for iOS

前端 未结 4 1705
广开言路
广开言路 2021-02-02 10:16

The documentation for Google Maps for iOS states that:

Call one of several methods that allow you to animate the camera moving to a new location. You can

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-02 10:29

    I found the answer ... you can control the animation duration by wrapping one of the animate* methods in a CATransaction, like this:

       [CATransaction begin];
       [CATransaction setValue:[NSNumber numberWithFloat: 1.0f] forKey:kCATransactionAnimationDuration];
       // change the camera, set the zoom, whatever.  Just make sure to call the animate* method.
       [self.mapView animateToCameraPosition: [self newCamera]];
       [CATransaction commit];
    

提交回复
热议问题