我的目標是讓一個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