2013-09-27 68 views
0

我在我的目標C項目中使用了兩個動​​畫。我似乎沒有得到它使用apportable工作。第一個方法是否會得到支持?CAKeyframeAnimation in Apportable

如果(標籤== 1) { CAKeyframeAnimation *動畫= [CAKeyframeAnimation animationWithKeyPath:@ 「位置」]; animation.duration = 3; animation.removedOnCompletion = YES; animation.fillMode = kCAFillModeForwards; animation.repeatCount = 1; //永遠重複 animation.autoreverses = NO; animation.rotationMode = kCAAnimationRotateAuto; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; animation.calculationMode = kCAAnimationCubic;

UIBezierPath *curvedPath = [UIBezierPath bezierPath]; 
    CGPoint cp; 
    cp.x=100; 
    cp.y=100; 
    [curvedPath moveToPoint:CGPointMake(300,300)]; 
    [curvedPath addLineToPoint:cp]; 

    animation.path=curvedPath.CGPath; 
    animation.delegate=self; 
    //self.alpha=0; 
    [ivcontainer.layer addAnimation:animation forKey:NULL]; 
} 
else 
{ 
    ivcontainer.center=CGPointMake(300,300); 
    [UIView beginAnimations:NULL context:NULL]; 
    [UIView setAnimationDuration:3]; 
    [UIView setAnimationRepeatCount:1]; 
    CGPoint cp; 
    cp.x=100; 
    cp.y=100; 
    ivcontainer.center=cp; 
    [UIView commitAnimations]; 
} 

回答

0

讓我改一下我的問題。如果好像我的問題被切斷了。

我在我的目標C項目中使用了兩個動​​畫。我似乎沒有得到它使用apportable工作。如果part是第一個方法,否則part是第二個方法這是否會被支持?

如果(標籤== 1) { CAKeyframeAnimation *動畫= [CAKeyframeAnimation animationWithKeyPath:@ 「位置」]; animation.duration = 3; animation.removedOnCompletion = YES; animation.fillMode = kCAFillModeForwards; animation.repeatCount = 1; //永遠重複 animation.autoreverses = NO; animation.rotationMode = kCAAnimationRotateAuto; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; animation.calculationMode = kCAAnimationCubic;

UIBezierPath *curvedPath = [UIBezierPath bezierPath]; 
    CGPoint cp; 
    cp.x=100; 
    cp.y=100; 
    [curvedPath moveToPoint:CGPointMake(300,300)]; 
    [curvedPath addLineToPoint:cp]; 

    animation.path=curvedPath.CGPath; 
    animation.delegate=self; 
    //self.alpha=0; 
    [ivcontainer.layer addAnimation:animation forKey:NULL]; 
} 
else 
{ 
    ivcontainer.center=CGPointMake(300,300); 
    [UIView beginAnimations:NULL context:NULL]; 
    [UIView setAnimationDuration:3]; 
    [UIView setAnimationRepeatCount:1]; 
    CGPoint cp; 
    cp.x=100; 
    cp.y=100; 
    ivcontainer.center=cp; 
    [UIView commitAnimations]; 
} 
+0

請編輯該問題 – LearnCocos2D