UIViewAnimation导致枚举类型的隐式转换

时间:2012-02-23 14:01:54

标签: objective-c ios ipad uiview 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

2 个答案:

答案 0 :(得分:1)

你正在使用一组不同的枚举:你必须把它放在一个UIViewAnimationTransition

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

当您使用UIViewAnimationCurve之一时:

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

它们仍然是整数但来自不同的常量组

答案 1 :(得分:0)

所有枚举都是整数。

您的通话方法需要UIViewAnimationTransition

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

您将其设置为UIViewAnimationCurve定义的值之一。