1

私のプログラムはクラッシュし続けます:

-(void) moveImage:(UIImageView *)image duration:(NSTimeInterval)duration curve:(int)curve    x:(CGFloat)x y:(CGFloat)y key:(NSString *)key
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationCurve:curve];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:)];

CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
image.transform = transform;
[UIView commitAnimations];
}

これが呼び出され、終了したら次のメソッドを呼び出します。

-(void)animationDidStop:(NSString *)key
{
if (key == @"burn") {
    //The burn card has been moved and stopped. Ready for the next.
    [self annPlayerRight];
}

}

私は何が間違っているのですか?

4

2 に答える 2

4

そうですね、setAnimationDidStopSelector:withObject:メソッドが存在しないため... UIView の実際のメソッドは次のとおりです。 + (void)setAnimationDidStopSelector:(SEL)selector

(withObject:パーツが欠品しておりますのでご了承ください)

于 2012-07-02T09:34:30.327 に答える
3

メソッドのドキュメントを確認してください。setAnimationDidStopSelector

アニメーションの終了後にアニメーション デリゲートに送信されるメッセージ。デフォルト値は NULL です。セレクターは次の形式である必要があります。

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context.

したがって、呼び出すと、メソッドでアクセスできるbeginAnimationsパラメーターがあります。contextanimationDIdStop

お役に立てれば。

于 2012-07-02T09:45:28.020 に答える