所以我使用 MapBox SDK,它是 RouteMe 的 iOS 地图 SDK 的一个分支。据我所知,注释的东西可能在这里。
我已经修改了一些我在这里找到的 CAAnimation 代码来尝试实现这一点。我的代码如下。由于我对 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);
}];
}];
}
}];
有任何想法吗?