Ios6 AQGridView单元格中的自定义动画是否立即发生?
所以,我正在使用AQGridView。我们有自定义单元格,其中包含图像。现在我们希望图像在单击时反弹。我试着在图像的框架上操作,但没有成功,所以现在我尝试在主视图中创建UIImageView,并给它一个路径动画,但最终发生的是视图只是出现在相关单元格的左上角的记录器中。这是相关代码Ios6 AQGridView单元格中的自定义动画是否立即发生?,ios6,core-animation,aqgridview,Ios6,Core Animation,Aqgridview,所以,我正在使用AQGridView。我们有自定义单元格,其中包含图像。现在我们希望图像在单击时反弹。我试着在图像的框架上操作,但没有成功,所以现在我尝试在主视图中创建UIImageView,并给它一个路径动画,但最终发生的是视图只是出现在相关单元格的左上角的记录器中。这是相关代码 -(void)bounce:(CoverGridCell*)v { UIView * w = [v.subviews objectAtIndex:0]; UIImageView * u = [[UII
-(void)bounce:(CoverGridCell*)v {
UIView * w = [v.subviews objectAtIndex:0];
UIImageView * u = [[UIImageView alloc] initWithImage:v.image];
u.frame = [self.view convertRect:[[w.subviews objectAtIndex:0] frame] fromView:w];
double __block y = u.frame.origin.y;
double __block x = u.frame.origin.x;
[self.view addSubview:u];
CGMutablePathRef cgmp = CGPathCreateMutable();for (int j= 10; j > 0;j--) {
CGAffineTransform t1 = CGAffineTransformMakeTranslation(0, - j*j);
CGAffineTransform t2 = CGAffineTransformInvert(t1);
CGPathMoveToPoint(cgmp,&t1, x, y - j * j);
CGPathMoveToPoint(cgmp,&t2, x, y);
}
CGPathRef cgp = CGPathCreateCopy(cgmp);
CGPathRelease(cgmp);
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath: @"position"];
anim.duration = 5.0;
anim.delegate = self;
anim.path = cgp;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
[u.layer addAnimation:anim forKey:@"DoesThisMatter"];
[u.layer setPosition:CGPointMake(x,y)];
}
这是一个线程问题,IIRC。单击单元格时发生的事情是冻结“Pad”,直到动画结束