Objective-C add MKOverlay to map view animated fade in

我只是一个虾纸丫 提交于 2019-12-11 18:06:53

问题


I've been trying to add an MKOverlay to a map with animation. I'm trying to make it fade in when it's added and fade out when it's removed. Could this be done by created a custom overlay class or overlay view class?


回答1:


On iOS 7 you could achieve this even with the new MKOverlayRenderer. It has an alpha property which you could animate by setting up a timer to repeatedly change its value and call setNeedsDisplayInMapRect:zoomScale:.




回答2:


This is trickier in iOS 7 and above since the overlays aren't represented with views anymore, but rather drawn with renderers (either using the stock ones or rendering yourself in a provided CGContext in the delegate).

Whatever you do here will be rendered on a tiled basis, which could lead to differences in appearance across you map view.

You can read more on this here: https://github.com/mapbox/mbxmapkit/issues/39



来源:https://stackoverflow.com/questions/22696949/objective-c-add-mkoverlay-to-map-view-animated-fade-in

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