开发者

Smooth annotation movement on OS 4

开发者 https://www.devze.com 2023-01-18 16:34 出处:网络
To move custom annotations in my MKMapView class, I remove all annotations first and add them (which are placed in new locations) again every second. It was perfectly working on iOS 3 but 开发者_高级运

To move custom annotations in my MKMapView class, I remove all annotations first and add them (which are placed in new locations) again every second. It was perfectly working on iOS 3 but 开发者_高级运维when I updated my OS and XCode to version 4.0, the annotations blink instead of having the smooth movement they used to have in previous version.

How can I keep this smooth movement?


This is probably a bad workaround and more effort than needed, but it should work:

  1. Get a UIImage by rendering the old MKMapView to a bitmap: Rendering UIView with its children
  2. Display that UIImage over your map view.
  3. Change your annotations (user doesn't see the blink because the image is covering the map view)
  4. Once the blink is done, quickly fade the image out. Not a perfect transition, but better than nothing.
0

精彩评论

暂无评论...
验证码 换一张
取 消