0

I have an animation that runs forward from an IBAction. On the next IBAction I would like it to reverse. I see that animateWithDuration had an autoreverse function but I only want it to go one way each time.

I have figured a workaround by simply loading a reverse array into the view but I am wondering if there's a more elegant solution.

4

2 に答える 2

1

ivarアニメーションを呼び出すオブジェクトとして、アニメーションの状態を保持します。

BOOLまたはとしてNSInteger。整数は 3 つ以上の状態を許可します。

例えば

BOOL animationState;

-(IBAction)actionWhichTriggers:(id)sender
{

if(animationState)
{
    animationState = NO;
    [self reverseAnimateMechanism];
}
else
{
   animationState = YES;
   [self forwardAnimateMechanism];
}


}   
于 2012-09-09T10:03:02.210 に答える
-1

良い質問!一部のアニメーションには、回転などの対応するものがあります。それらにはよりエレガントな方法があります。

于 2012-09-09T01:29:25.173 に答える