我的目标是让一个UITableViewCell
滑过屏幕的一侧(如Twitter),然后从另一侧滑回。我能够让单元格滑出屏幕右侧,但我似乎无法弄清楚如何从左后角将它滑回屏幕上。这里是我的代码滑动它的权利:幻灯片UITableViewCell
UITableViewCell *cell = [self cellForRowAtIndexPath:indexPath];
[cell.layer setAnchorPoint:CGPointMake(0, 0.5)];
[cell.layer setPosition:CGPointMake(cell.frame.size.width, cell.layer.position.y)];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.x"];
[animation setRemovedOnCompletion:NO];
[animation setDelegate:self];
[animation setDuration:0.14];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
[cell.layer addAnimation:animation forKey:@"reveal"];
感谢您的任何帮助!
这对我而言不起作用(请参阅我对XJones的回答的评论)。我真正需要的是一种与我的问题相反的方式。 – edc1591 2011-04-12 20:56:15
我使用了我所描述的技术来为自定义表格单元格进行动画处理,以了解它的价值。祝你好运! – 2011-04-12 21:02:17