2012-02-23 56 views
2

我得到這個警告UIViewAnimation導致從枚舉類型

從枚舉類型從最後一行「UIViewAnimationCurve」不同的枚舉類型「UIViewAnimationTransition」

在此代碼

隱式轉換

if (((UIView*)[[slideViews subviews] objectAtIndex:0]).frame.origin.x > SLIDE_VIEWS_MINUS_X_POSITION) { 
    UIView* tempRight2View =[[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-1]; 
    [UIView beginAnimations:@"ALIGN_TO_MINIMENU" context:NULL]; 
    [UIView setAnimationTransition:UIViewAnimationCurveEaseInOut forView:viewAtLeft cache:YES]; 
隱式轉換

我從StackScrollView調整代碼,任何知道如何「明確」轉換?

TIA

+0

方法'[UIView beginAnimations:context:]'已被棄用,您不應該再使用它了。 – Sulthan 2012-02-23 14:25:42

回答

1

您正在使用一組不同的枚舉:有你必須把其中一個UIViewAnimationTransition

typedef enum { 
UIViewAnimationTransitionNone, 
UIViewAnimationTransitionFlipFromLeft, 
UIViewAnimationTransitionFlipFromRight, 
UIViewAnimationTransitionCurlUp, 
UIViewAnimationTransitionCurlDown} UIViewAnimationTransition; 

,而你正在使用UIViewAnimationCurve之一:

typedef enum { 
UIViewAnimationCurveEaseInOut, 
UIViewAnimationCurveEaseIn, 
UIViewAnimationCurveEaseOut, 
UIViewAnimationCurveLinear} UIViewAnimationCurve 

他們仍然是所有的整數,但是來自不同的常量組

0

所有枚舉都是整數。

您打電話的方法需要UIViewAnimationTransition

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition 
         forView:(UIView *)view 
         cache:(BOOL)cache; 

您將其設置爲由UIViewAnimationCurve定義的值之一。