嗨,我试图创建侧数菜单,但要警告我索取了许多选项,对我有什么用,请帮助我
我使用的代码:
-(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;
}];
}
这是警告我得到的
Implicit conversion from enumeration type 'enum UIViewAnimationCurve' to different enumeration type 'UIViewAnimationOptions' (aka 'enum UIViewAnimationOptions')
我为解决方案提供了SEACH,我看到了一些ANS它不起作用I Xcode 5链接我找到了解决方案在上面的链接中,被告知要
他们告诉把这个
uiviewAnimationOptionCurveEaseout
而不是
uiviewAnimationCurveEaseout
但是它不起作用,我需要帮助
在iOS 4.0及更高版本中不建议使用此方法。相反,您应该使用animateWithDuration:delay:options:animations:completion:
方法来指定动画和动画曲线选项。
您需要使用: uiviewKeykeyFrameAnimationOptions 枚举用于解决问题。
animateKeyframesWithDuration:
将UIViewKeyframeAnimationOptions
选项作为第三个参数。您正在通过UIViewAnimationCurve
枚举而不是UIViewKeyframeAnimationOptions
。
参考:
animateKeyframesWithDuration:delay:options:animations:completion:
创建一个可用于设置的动画块对象 当前视图的基于密钥帧的动画。
+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewKeyframeAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion
参数
持续时间
以秒为单位测量的整体动画持续时间。如果指定负值或0,则立即进行更改,并且 没有动画。
延迟
指定时间(以秒为单位)在开始动画之前等待。
选项
选项蒙版,指示您要如何执行动画。有关有效常数列表,请参见 " uiviewKeyFrameAnimationptions"。
动画
一个包含要更改的块对象。通常,您打电话给 AddKeyFrameWithReLativEstarttime:plerativeRation:动画:方法 该块内部一次或多次。您也可以更改视图 如果您希望这些更改能够直接在整个上进行动画 期间。该块没有参数,也没有返回值。做 不为此参数使用零值。完成
动画序列结束时要执行的块对象。该块没有返回值,并且需要一个布尔参数 这表明动画是否在 完成处理程序被称为。如果动画的持续时间为0, 该块是在下一个运行循环周期开始时执行的。 您可以为此参数使用零值。
根据苹果文档,选项应为。
uiviewKeyFrameAnimationOptions animateKeyframesWithDuration:delay:options:animations:completion: method.
使用的关键框架动画选项,因此选项应如下。
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;
否则,它将显示警告,并且在64位应用程序中,可能会导致严重问题。
使用此选项:
UIViewAnimationOptionCurveEaseOut
这确实需要更改以使警告要离开。