iphone - How can I create a custom "pin-drop" animation using MKAnnotationView? -


I have an example of MKMapView and want to use custom annotation icon instead of standard PIN There is therefore the icon provided by MKPinAnnotationView, I have set up is called a subclass CustomMapAnnotation called MKAnnotationView and override - (void) drawRect: this works to draw a CGImage.

Trouble comes when I try to repeat the functionality supplied by .aimatesDrop MKPinAnnotationView; I love to show my mouse slowly, in the top and to the left-to-right order, when annotation is added to the MKMapView example.

here - (zero) drawRect: for CustomMapAnnotation, which works when you just draw UIImage (which is the second line):

  - ( Zero) drawRect: (CGRect) rect {[super drawRect: rect;); [(Event (conviction *) Self annotation. Draw the least icon: Rect; if (new annotation) {[Voltage of itself]; New Innovation = No;}}  

when you animateDrop method to add so much trouble:

  - (minus) animated {CGContextRef myContext = UIGraphicsGetCurrentContext (); CGPoint finalPos = self.center; Sijeepoint Start Peace = CP Pointmek (Self. Sentr.aks shelves. center - 400.0); Self. Leyrksodn = Start PO; CABasicAnimation * theAnimation; TheAnimation = [CABasic animation animation Sathkepath: @ "Status"]; TheAnimation.fromValue = [NSVLite valueWithCGPN: startPos]; TheAnimation.toValue = [NSValue Value withCGP Answer: finalPos]; TheAnimation.removedOncompletion = No; TheAnimation.fillMode = kCAFillModeForwards; TheAnimation.delegate = self; TheAnimation.beginTime = 5.0 * (Auto Center / X320.0); TheAnimation.duration = 1.0; [Self Learner Animation: The Animation Fork: @ ""];}  

It's Not Just Working , And there are many reasons for this why I do not come in all of them. I want to know that the main thing is that the approach is absolutely right, or I should try some different way.

I tried to package the whole thing in an animation transaction so that the startTime parameter can actually work; There was nothing like that. I do not know what this is because I am missing some important point, because McKit is garbling my animation in some way.

  // Nothing [Catering session started]; [Add map annotation: list]; [Catransens Cameat];  

If someone has any experience with animated Mkmap annotations like this, I like some signals, otherwise if you can provide CA animation advice on the approach, it is very good Will happen.

The second is that this user space also leaves the blue dot. With this code given below, you handle a large amount of both user space and off-screen map. I've also added bounce a nice;)

  - (minus) Map View (Mkemapdrishy *) map Dekenadadannoteshndrishy: (Ansaarara *) View (Mkeanoteshnwu * AV; (AV scene) {/ Do not pin the comment if the annotation is the user's location (if [Aviation is anonymation KindOfClass: [MKUserLocation class]] {continue;} // Check that the current annotation is within visible map text, next one MKMapPoint point = Go to MKMapPointForCoordinate (aV.annotation.coordinate);; (MKMapRectContain sPoint (self.mapView.visibleMapRect, point)) {continue;} Sijiarakt Andfrem = A Vikfrem; // see the view annotations AV.frame = CGRectMake (aV.frame.origin.x, aV.frame.origin. Y - self.view.frame.size.height, aV.frame.size.width, aV.frame .size.height); // Animate drop [UIView animativation: 0.5 delay: 0.04 * [views index object: avi] option : UIViewAnimationCurveLinear Animation: ^ {aV.frame = endFrame; // animate squash} completion: ^ (end BOOL) {if (finished) {[UIView animateWithDuration: 0.05 Animation: ^ {aV.transform = CGAffineTransformMakeScale (1.0, 0.8); } Closing: ^ (BOOL Finish) {[UIView animateWithDuration: 0.1 Animation: ^ {aV.transform = CGAffineTransformIdentity; }]; }]; }}]; }}  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -