【发布时间】:2011-04-03 15:41:35
【问题描述】:
抱歉,这是非常基本的,但我无法将 AnimationOption 从默认 (EaseIn) 设置为 CurveLinear。这是我根据我在其他线程中阅读的内容所尝试的:
-(void)animationShadow;
{
[UIView animateWithDuration:4
options:UIViewAnimationOptionCurveLinear
animations:^{
...
如果我去掉选项位,一切正常。如果没有,它会崩溃。我确定我没有调用正确的命令。
这是整个方块动画:
-(void)animationShadow;
{
[UIView animateWithDuration:4
options:UIViewAnimationOptionCurveLinear
animations:^{
//UIViewAnimationOptionCurveLinear
// animation 1
[pageShadowView setTransform:CGAffineTransformMakeScale (3, 1)];
[pageShadowView setFrame:CGRectMake(0-350, 0, CGRectGetWidth(pageShadowView.frame), CGRectGetHeight(pageShadowView.frame))];
[UIView beginAnimations:@"pageCurlRightToLeftFinished" context:nil]; // Begin animation
//[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[pageShadowView setFrame:CGRectMake(0-280, 0, CGRectGetWidth(pageShadowView.frame), CGRectGetHeight(pageShadowView.frame))];
[UIView commitAnimations];
} completion:^(BOOL finished){ ...
编辑:
好的,我现在更新了这个,但是如果我做第二个动画,我仍然会崩溃。我收到警告:UIView 可能无法响应 +animateWithDuration ...:
-(void)动画阴影; {
[pageShadowView setTransform:CGAffineTransformMakeScale (3, 1)];
[pageShadowView setFrame:CGRectMake(0-350, 0, CGRectGetWidth(pageShadowView.frame), CGRectGetHeight(pageShadowView.frame))];
[UIView animateWithDuration:kPageCurlSpeed/4
delay:0
options:UIViewAnimationOptionCurveLinear
animations:^{
[pageShadowView setFrame:CGRectMake(0-280, 0, CGRectGetWidth(pageShadowView.frame), CGRectGetHeight(pageShadowView.frame))];
}
completion:^(BOOL finished){
[UIView animateWithDuration:kPageCurlSpeed
delay:0
options:UIViewAnimationOptionCurveLinear
animations:^{
// animation 2
[pageShadowView setTransform:CGAffineTransformMakeScale (0.1, 1)];
[pageShadowView setFrame:CGRectMake((340-pageShadowView.frame.size.width), 0, CGRectGetWidth(pageShadowView.frame), CGRectGetHeight(pageShadowView.frame))];
}
]; // this is where I get the warning!!
}];
}
【问题讨论】:
标签: iphone objective-c cocoa-touch animation uiview