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

时间:2022-04-22 16:07:26

I'm getting this warning

我收到了这个警告

Implicit conversion from enumeration type 'UIViewAnimationCurve' to different enumeration type 'UIViewAnimationTransition'

从枚举类型'UIViewAnimationCurve'到不同枚举类型'UIViewAnimationTransition'的隐式转换

from the last line in this code

从此代码的最后一行

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]; 

I'm adapting code from StackScrollView, any know how to "explicitly" convert?

我正在调整StackScrollView中的代码,任何知道如何“明确”转换?

TIA

2 个解决方案

#1


1  

you are using a different set of enum: there you must put one of the UIViewAnimationTransition

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

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

while you are using one of UIViewAnimationCurve:

当你使用UIViewAnimationCurve时:

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

they are still all integer but from different groups of constants

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

#2


0  

All enums are integers.

所有枚举都是整数。

The method your calling takes a UIViewAnimationTransition.

你的调用方法采用UIViewAnimationTransition。

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

you're setting it to one of the values defined by UIViewAnimationCurve.

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

#1


1  

you are using a different set of enum: there you must put one of the UIViewAnimationTransition

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

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

while you are using one of UIViewAnimationCurve:

当你使用UIViewAnimationCurve时:

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

they are still all integer but from different groups of constants

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

#2


0  

All enums are integers.

所有枚举都是整数。

The method your calling takes a UIViewAnimationTransition.

你的调用方法采用UIViewAnimationTransition。

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

you're setting it to one of the values defined by UIViewAnimationCurve.

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