CABasicAnimation *contentMove = [CABasicAnimation animationWithKeyPath:@"contentsRect.origin.y"];
    contentMove.fromValue = [NSNumber numberWithFloat:1.0f];
    contentMove.toValue   = [NSNumber numberWithFloat:1.0f];

    contentMove.duration  = 2;
    
    CAAnimationGroup *group = [CAAnimationGroup animation];
    group.delegate = self;
    [group setDuration:2];
    [group setFillMode:kCAFillModeForwards];
    group.removedOnCompletion =NO;
    [group setAnimations: [NSArray arrayWithObjects:contentMove,nil]];
    [group setBeginTime:CACurrentMediaTime()];
    [self.imageV.layer addAnimation:group forKey:@"WW"];
应该看不到对象才对啊
    

解决方案 »

  1.   

    你给的图看不出你要实现什么样的动画效果,最好弄个gif图片上来或再用文字描述一下吧。还有你上面的代码中
    contentMove.fromValue = [NSNumber numberWithFloat:1.0f];
    contentMove.toValue   = [NSNumber numberWithFloat:1.0f];
    fromValue 与toValue 值一样,即使动画生效你也看不到变化。
      

  2.   

    contentMove.fromValue = [NSNumber numberWithFloat:1.0f];
        contentMove.toValue   = [NSNumber numberWithFloat:0.0f];从上到下出现,但是有一个拉伸
      

  3.   


    你这个动画只是一个位置的移动动画,你不能只设置y轴坐标,需要通过点来移动。见下面代码
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];  
       
    // 动画选项的设定  
    animation.duration = 2.5; // 持续时间  
    animation.repeatCount = 1; // 重复次数  
       
    // 起始帧和终了帧的设定  
    animation.fromValue = [NSValue valueWithCGPoint:myView.layer.position]; // 起始帧  
    animation.toValue = [NSValue valueWithCGPoint:CGPointMake(320, 480)]; // 终了帧  
       
    // 添加动画  
    [myView.layer addAnimation:animation forKey:@"move-layer"];
      

  4.   

    只是这段代码ios8和以前的执行效果不一样,ios8里才有下面的拉伸,以前版本都是移动出现