2011-06-18 9 views
0

トラブルここでのiOS 4でアニメーションを設定したAmはviewDidLoadメソッド内のコードです:アニメーションの問題

//---animate the two views flipping--- 
[UIView beginAnimations:@"flipping view" 
context:nil]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight:tempImageView 
cache:YES]; 

[tempImageView setHidden:YES]; 

[UIView commitAnimations]; 

[UIView beginAnimations:@"flipping view" 
      context:nil]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight:tempImageView 
        cache:YES]; 

[UIImageView setHidden:NO]; 

[UIView commitAnimations]; 

コードはコンパイルが、私は、メソッド '+のsetAnimationTransitionを読み込むメッセージが表示されます:: cache: 'が見つかりません(戻り値の型は' id 'にデフォルト設定されています)

私がページコントロールを押すと、アプリケーションがクラッシュしました。ここにコンソールが言ったものがあります:

2011-06-18 14:06:48.249 UsingViews[2093:207] +[UIView setAnimationTransition::cache:]: unrecognized selector sent to class 0x58f3b4 
2011-06-18 14:06:48.255 UsingViews[2093:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIView setAnimationTransition::cache:]: unrecognized selector sent to class 0x58f3b4' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x00dc25a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x00f16313 objc_exception_throw + 44 
    2 CoreFoundation      0x00dc417b +[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x00d33966 ___forwarding___ + 966 
    4 CoreFoundation      0x00d33522 _CF_forwarding_prep_0 + 50 
    5 UsingViews       0x00002d97 -[UsingViewsViewController pageTurning:] + 935 
    6 UIKit        0x000144fd -[UIApplication sendAction:to:from:forEvent:] + 119 
    7 UIKit        0x000a4799 -[UIControl sendAction:to:forEvent:] + 67 
    8 UIKit        0x000a6c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    9 UIKit        0x001cdfaa -[UIPageControl endTrackingWithTouch:withEvent:] + 386 
    10 UIKit        0x000a578b -[UIControl touchesEnded:withEvent:] + 381 
    11 UIKit        0x00038ded -[UIWindow _sendTouchesForEvent:] + 567 
    12 UIKit        0x00019c37 -[UIApplication sendEvent:] + 447 
    13 UIKit        0x0001ef2e _UIApplicationHandleEvent + 7576 
    14 GraphicsServices     0x00ffb992 PurpleEventCallback + 1550 
    15 CoreFoundation      0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    16 CoreFoundation      0x00d03cf7 __CFRunLoopDoSource1 + 215 
    17 CoreFoundation      0x00d00f83 __CFRunLoopRun + 979 
    18 CoreFoundation      0x00d00840 CFRunLoopRunSpecific + 208 
    19 CoreFoundation      0x00d00761 CFRunLoopRunInMode + 97 
    20 GraphicsServices     0x00ffa1c4 GSEventRunModal + 217 
    21 GraphicsServices     0x00ffa289 GSEventRun + 115 
    22 UIKit        0x00022c93 UIApplicationMain + 1160 
    23 UsingViews       0x000023b9 main + 121 
    24 UsingViews       0x00002335 start + 53 
) 
terminate called after throwing an instance of 'NSException' 
(gdb) 

何が間違っているのか教えてください。前もって感謝します!

答えて

1

メソッド名がsetAnimationTransition:forView:cache:ないsetAnimationTransition::cache:

変更

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight:tempImageView cache:YES]; 

ある

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:tempImageView cache:YES]; 
+0

に機能するようになりました、ありがとうございました! – pdenlinger