0

UIView の touchesBegan メソッド内にいくつかの操作とアニメーションがあり、これをサブクラス化し、View のクラスとして追加します。アニメーション間に遅延が必要です。

コード:

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    // Add delay to imitate the hold for touch 1 second and if true continue
    // else cancel everything

    [self animateViewSize]; // Here animates the view frame

    // Add delay until sizing animation ends.....

    [self animateViewFlip]; // Here animates the view flip y axis

    [[NSNotificationCenter defaultCenter] postNotificationName:@"A Notification" object:self];
    // Notify the superview Controller that touch happened and do some operations with  animations too...

    // Some variables appending values for the UIView location when it touched
}

- (void) animateCardSize
{
    // Animate using UIView animation
}
- (void) animateFlipView
{
     // Animate flip using CABasicAnimation
}

これが基本的な考え方です.....

ありがとうございました。

4

2 に答える 2

2

ブロックベースの UiView アニメーションでこれを行うことができます。

[UIView animateWithDuration:0.4 animations:^{
    //Your first anim here
} completion:^(BOOL finished){
    //Your second anim here
}];
于 2012-07-13T12:58:03.473 に答える
1

メソッドで使用することもできます

[self performSelector:@selector(animateCardSize) withObject:nil afterDelay:(2.0f)];
//2.0 and animateCardSize as examples
于 2012-07-13T15:18:26.507 に答える