Reputation: 744
This is my code for giving a crossdissolve effect for an image
- (void)viewDidLoad
{
[super viewDidLoad];
typedef enum
{
UIViewAnimationOptionTransitionCrossDissolve,
UIViewAnimationOptionTransitionCurlDown,
UIViewAnimationOptionTransitionCurlUp,
UIViewAnimationOptionTransitionFlipFromBottom,
UIViewAnimationOptionTransitionFlipFromLeft
} UIViewAnimationOptions;
[UIView animateWithDuration:1.0 animations:^(void){
[UIView setAnimationTransition: UIViewAnimationOptionTransitionCrossDissolve forView:img cache: YES];
} completion:^(BOOL finished){
[UIView animateWithDuration:1.0 animations:^(void){
[UIView setAnimationTransition: UIViewAnimationOptionTransitionCrossDissolve forView:img cache: YES];
} completion:^(BOOL finished){
}];
}];
}
But i am getting a warning implicit conversion from enumeration type 'enum UIViewAnimationOption to different enumeration type uiviewanimation transition.
But if i give UIViewAnimationTransitionFlipFromRight,UIViewAnimationTransitionCurlUp ..... it is working,but animatewithoptions is giving warning.
can anyone help me?
Upvotes: 0
Views: 4322
Reputation: 107211
You are using the enum of UIViewAnimationOption
.
The enum defined for UIViewAnimationTransition
is:
typedef enum {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
UIViewAnimationTransitionCurlUp,
UIViewAnimationTransitionCurlDown,
} UIViewAnimationTransition;
Please check UIView Class for reference.
Also remove the enum defined by you, there is no need of it. The iOS already have the enum for UIView
class.
Upvotes: 2
Reputation: 11174
You don't need to typedef the animation options enum, its already been done
The error is telling you what is wrong, you are passing in a type UIViewAnimationOption
when the method expects a UIViewAnimationTransition
the valid options for animation transition are:
typedef enum {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
UIViewAnimationTransitionCurlUp,
UIViewAnimationTransitionCurlDown,
} UIViewAnimationTransition;
Upvotes: 0