iOS のメール アプリで、受信トレイに移動してアイテムをスワイプすると、アーカイブ ボタンが右から左に表示されます (そして、それが消えたときの回避策)。私は自分のアプリでこの動作を取得しようとしています。これにアプローチした方法は、ボタンのマスクレイヤーをアニメーション化し、右から左に移動することです。ここでの問題は、アニメーションが終了するとボタンが消えることです。
//Create Mask Layer
CALayer *maskLayer = [CALayer layer];
maskLayer.frame = CGRectMake(cell.deleteButton.frame.size.width,0,cell.deleteButton.frame.size.width,cell.deleteButton.frame.size.height);
maskLayer.backgroundColor = [UIColor whiteColor].CGColor;
cell.deleteButton.layer.mask = maskLayer;
// Setting the animation
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.x"];
animation.byValue = [NSNumber numberWithFloat:-cell.deleteButton.frame.size.width];
animation.duration = 0.4f;
[cell.deleteButton.layer.mask addAnimation:animation forKey:@"maskAnimation"];
アニメーションの後にボタンが消えないようにする方法や、アニメーションを作成するためのより良い方法があるかどうか疑問に思います。