Проблема с анимацией в iOS 4 - PullRequest
0 голосов
/ 19 июня 2011

У меня проблемы с настройкой анимации в iOS 4. Вот код в методе 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];

Пока код компилируется, я получаю сообщение, которое читает Method '+ setAnimationTransition :: cache:' not found (тип возвращаемого значения по умолчанию равен '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 Ответ

1 голос
/ 19 июня 2011

Имя метода setAnimationTransition:forView:cache:, а не setAnimationTransition::cache:

Изменить

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

до

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:tempImageView cache:YES];
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...