Animated MKOverlayView

可紊 提交于 2019-12-08 01:46:41

问题


I've run across a couple of similar questions here regarding getting an animated MKOverlayView working property with decent performance (e.g., an animated radar overlay). However, while the answers have helped lead me in the right direction, I still don't fully grasp what I'm missing yet.

I've been trying to get this UIImageView method working, which simply adds an UIImageView as a subview of the MKOverlayView, then adds the necessary images in the animation sequence to its animationImages property. This doesn't seem to work for me as the UIImageView and its associated images are never rendered. I've even tried calling setNeedsDisplay on the overlay view which also doesn't help. In my instance, the images used in the animation have to be loaded from a remote server first and are updated fairly frequently.

There's also this method that suggests using cocos2D to setup an animated sprite, which I'd like to avoid if the above method with UIImageView works successfully.

I've been struggling with this for two days straight now, so there's likely something I'm totally missing? Do I need to use Core Graphics to do the drawing similar to how it's performed in the main drawMapRect:zoomScale:inContext: method (which I've also tried but didn't work)?


回答1:


Maybe you can try this. Subclass the MKCircleView and animate a UIImageView added on it with Core Animation. It works well with the map moving around and scale with the map zoom in and out.

http://yickhong-ios.blogspot.com/2012/04/animated-circle-on-mkmapview.html



来源:https://stackoverflow.com/questions/7746070/animated-mkoverlayview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!