因此,我使用MapBox SDK,它是適用於iOS的RouteMe地圖SDK的一個分支。從我所知道的,註釋的東西可能在這裏。使用CAAnimation在RMMapView上動畫RMPointAnnotation
我修改了一些CAAnimation代碼,我發現here試圖實現這一點。我的代碼如下。 由於我對CAAnimation相當陌生,因此可能出現這個問題,或者使用RouteMe代碼本身。它只是動畫註釋包裝的圖層。
RMPointAnnotation *point = [[RMPointAnnotation alloc] initWithMapView:self.mapView coordinate:CLLocationCoordinate2DMake([location[@"lat"] floatValue], [location[@"lon"] floatValue]) andTitle:@"App open"];
point.image = [UIImage imageNamed:@"mapPin.png"];
[self.mapView addAnnotation:point];
CGRect endFrame = point.layer.frame;
// Move annotation out of view
point.layer.frame = CGRectMake(point.layer.frame.origin.x, point.layer.frame.origin.y - self.mapView.frame.size.height, point.layer.frame.size.width, point.layer.frame.size.height);
// Animate drop
[UIView animateWithDuration:2.0 delay:0.04 options:UIViewAnimationOptionCurveLinear animations:^{
point.layer.frame = endFrame;
// Animate squash
}completion:^(BOOL finished){
if (finished) {
[UIView animateWithDuration:0.05 animations:^{
point.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(1.0, 0, 0, 0.8, 0, + point.layer.frame.size.height*0.1));
}completion:^(BOOL finished){
[UIView animateWithDuration:0.1 animations:^{
point.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformIdentity);
}];
}];
}
}];
任何想法?
您能否提供CAAnimations解決方案的代碼示例? –
對不起,我不再訪問代碼庫,但我知道Facebook剛剛爲此https://code.facebook.com/projects/642915749111632/pop/ –
發佈了一個庫感謝提示,Sam,圖書館似乎是很有用!我會使用流行音樂提交我的解答回覆 –