Is there anyway to have an animated annotation for WKInterfaceMap
of Watchkit?
I have 35 images to form the animation. Currently I am using a NSTimer
which calls
-(void)addAnnotation:(CLLocationCoordinate2D)location withImageNamed:(NSString *)name centerOffset:(CGPoint)offset
method with a different image names but the result is not efficient and the animation is not smooth as everytime it has to first remove the previous annotation and add a new one.
Any comment/suggestion is greatly appreciated.
I think this can not be achieved using WKInterfaceMap but it can be achieved using WKInterfaceImage. I have not implemented all steps but flow can be,
Generate snapshot of Map with selected lat-long in centre as UIImage using MKMapSnapshotter,
We already have Annotation image in resource So dynamically create merged images of annotation image to map snapshot image. If you want to add animation from top then you need to render annotation image from point (150,0) to (150,150) on map image. If you are generating 15 images for animation then you need set for loop with 15 limit and each time increase Y of annotation image to 150/15 = 10. Keep track of these merged images in NSMutableArray. You may consider this answer for rendering images.
Use these dynamically generated NSMutableArray of images and set to Animation for WKInterfaceImage to achieve map annotation.