【发布时间】:2012-03-30 20:03:57
【问题描述】:
我使用以下代码块向下滑动 UIView,并在完成后旋转另一个 UIView。 动画的第二部分,完成块只执行一次,这意味着第一个动画没有完成,否则它将到达完成块。 在 iphone 模拟器上,它看起来好像第一个动画确实完成了...... 谁能帮我解决这个问题? 我的 NSLog 说:
第一次完成
第二次开始
第一次完成
第一次完成
第一次完成
.
.
.
- (IBAction) move
{
[UIView animateWithDuration:0.7 animations:^{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.7];
[UIView setAnimationRepeatCount:1];
[UIView setAnimationRepeatAutoreverses:NO];
CGPoint pos = movingtTable.center;
float moveDistance = 220.0;
if(!isViewVisible){
//expose the view
pos.y = pos.y+moveDistance;
//disable selection for xy table
xTable.userInteractionEnabled = NO;
yTable.userInteractionEnabled = NO;
//angle = M_PI;
}
else
{
pos.y = pos.y-moveDistance;
xTable.userInteractionEnabled = YES;
yTable.userInteractionEnabled = YES;
//angle = -M_PI;
}
isViewVisible = !isViewVisible;
movingtTable.center = pos;
NSLog(@"finished 1st");
}completion:^(BOOL finished){
NSLog(@"started 2nd");
[UIView animateWithDuration:0.4 animations:^{
//[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
//[UIView setAnimationRepeatCount:1];
//[UIView setAnimationRepeatAutoreverses:NO];
arrows.transform = CGAffineTransformMakeRotation(angle);
}completion:^(BOOL finished){
angle = -angle;
}];
}];
【问题讨论】:
-
丹,这两个答案对您有帮助吗?你找到他们工作了吗?如果是这样,如果您“接受”最好的一个或根据您的发现制作 cmet,这对每个人都有帮助。干杯
标签: ios objective-c