Reputation: 117
hi im trying to create side number side menu but getting a warning i have seached many option nothing had worked for me pls help me
the code i have used :
-(void) animatedLayerToPoint:(CGFloat)x
{
[UIView animateKeyframesWithDuration:0.3 delay:0
options:UIViewAnimationCurveEaseOut
animations:^{
CGRect frame = self.toplayer.frame;
frame.origin.x = x;
self.toplayer.frame = frame;
}
completion:^(BOOL finished){
self.layerPosition = self.toplayer.frame.origin.x;
}];
}
this is the warning im getting
Implicit conversion from enumeration type 'enum UIViewAnimationCurve' to different enumeration type 'UIViewAnimationOptions' (aka 'enum UIViewAnimationOptions')
i seached for solution i had seen some of the ans its not working i xcode 5 link i found solution in above link the told to give
they telling to put this one
UIViewAnimationOptionCurveEaseOut
instead of
UIViewAnimationCurveEaseOut
but its not working pls i need help
Upvotes: 0
Views: 1935
Reputation: 746
use this option instead:
UIViewAnimationOptionCurveEaseOut
That's really all you need to change to make the warning to away.
Upvotes: 0
Reputation: 23291
Use of this method is discouraged in iOS 4.0 and later. Instead, you should use theanimateWithDuration:delay:options:animations:completion:
method to specify your animations and the animation curve options.
Upvotes: 1
Reputation: 107211
You need to use: UIViewKeyframeAnimationOptions enum for fixing the issue.
animateKeyframesWithDuration:
takes UIViewKeyframeAnimationOptions
option as it's 3rd argument. You are passing the UIViewAnimationCurve
enum instead of UIViewKeyframeAnimationOptions
.
animateKeyframesWithDuration:delay:options:animations:completion:
Creates an animation block object that can be used to set up keyframe-based animations for the current view.
+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion
Parameters
duration
The duration of the overall animation, measured in seconds. If you specify a negative value or 0, changes are made immediately and without animations.
delay
Specifies the time (in seconds) to wait before starting the animation.
options
A mask of options indicating how you want to perform the animations. For a list of valid constants, see “UIViewKeyframeAnimationOptions”.
animations
A block object containing the changes to commit to the views. Typically, you call the addKeyframeWithRelativeStartTime:relativeDuration:animations: method one or more times from inside this block. You may also change view values directly if you want those changes to animate over the full duration. This block takes no parameters and has no return value. Do not use a nil value for this parameter. completion
A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. You can use a nil value for this parameter.
Upvotes: 1
Reputation: 17595
According to apples docs, the options should be.
UIViewKeyframeAnimationOptions
Key frame animation options used with the animateKeyframesWithDuration:delay:options:animations:completion: method.
So your
Options should be as below.
typedef enum {
UIViewKeyframeAnimationOptionLayoutSubviews = UIViewAnimationOptionLayoutSubviews,
UIViewKeyframeAnimationOptionAllowUserInteraction = UIViewAnimationOptionAllowUserInteraction,
UIViewKeyframeAnimationOptionBeginFromCurrentState = UIViewAnimationOptionBeginFromCurrentState,
UIViewKeyframeAnimationOptionRepeat = UIViewAnimationOptionRepeat,
UIViewKeyframeAnimationOptionAutoreverse = UIViewAnimationOptionAutoreverse,
UIViewKeyframeAnimationOptionOverrideInheritedDuration = UIViewAnimationOptionOverrideInheritedDuration,
UIViewKeyframeAnimationOptionOverrideInheritedOptions = UIViewAnimationOptionOverrideInheritedOptions,
UIViewKeyframeAnimationOptionCalculationModeLinear = 0 << 9,
UIViewKeyframeAnimationOptionCalculationModeDiscrete = 1 << 9,
UIViewKeyframeAnimationOptionCalculationModePaced = 2 << 9,
UIViewKeyframeAnimationOptionCalculationModeCubic = 3 << 9,
UIViewKeyframeAnimationOptionCalculationModeCubicPaced = 4 << 9
} UIViewKeyframeAnimationOptions;
Otherwise It will show warning and in 64-bit application, it may lead to serious issue.
Upvotes: 0