Is it possible to move/rotate GMSMarker
on GMSMapView
with animation?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- How do you change the color of the dotted line on
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- Avoiding “Sorry, we have no imagery here” with Goo
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
The addition in 1.2 is that the
GMSMarker
class has ananimated
property - I presume you just set it toYES
, before adding the marker to the map by settings itsmap
property (I haven't tried it though).https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_marker
I presume this means that the marker will be animated when it is dropped onto the map - not that you can make a high-speed animated marker like this original question was asking.
No I'm afraid they are not as we have no access to the OpenGL context that Google Maps has access to. The best you can do is rotate a marker as a UIImage which requires a redraw or you can move a marker but it will jump unless you do it in very small increments!
I suggest reporting a bug to Google and they may be able to include it
My solution was to subclass the GMSMarker class and add support for PNG sequences using a timer. Here's a rough sketch of the code:
.h:
.m
And then once you instantiate one, just send it something like this:
And make sure your library has a bunch of PNGs of the same size and registration that are named "some_library_name0" "some_library_name1", etc. The frame array treatment allows you to repeat frames without creating new PNGs.
Performance-wise, it's very slow to animate in the simulator but seems pretty performant on the device.
Good luck!
For now markers only have an option to appear animated.
Recently wrote clusterization lib for Google Maps SDK for iOS with animated collapse/disintegration. And the approach I used was animation through manual position update. If there's a lot markers on screen simultaneously animating it's sloow (even with all the possible calculations in background and results caching), so needs a lot of optimizations and limitations. So for now it's good to think a lot if you really need animations like this with Google Maps SDK for iOS or sometimes, especially on older devices, the optimization you'll have to use will be disabling your custom animations at all.