3

デフォルトのオプションがあることは知っていますがUITableViewRowAnimation、独自のアニメーションを作成する方法はありますか?もしそうなら、これに関する彼らのチュートリアルはありますか?

セルをユーザーに向かってズームしてから、画面から飛び出します。

私はこれについて多くを見つけることができないようです...

4

1 に答える 1

0

1 つの方法は willDisplayCell にあります。UIView/CAAnimation API にアクセスできます。例:

- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{   
    //1. Define the initial state (Before the animation)
    cell.layer.shadowColor = [[UIColor blackColor]CGColor];
    cell.layer.shadowOffset = CGSizeMake(10, 10);
    cell.alpha = 0;
    cell.transform = CGAffineTransformMakeScale(0.85, 0.85);

    //2. Define the final state (After the animation) and commit the animation
    [UIView beginAnimations:@"scale" context:NULL];
    [UIView setAnimationDuration:0.5];
    cell.transform = CGAffineTransformIdentity;
    cell.alpha = 1;
    cell.layer.shadowOffset = CGSizeMake(0, 0);
    [UIView commitAnimations];
}

これは、セルに適用される単純な「スケール」、シャドウ、およびアルファインです。テーブルがスクロールすると、セルが拡大されて不透明になります。ここでは本当にやりたいことが何でもできます。

于 2015-06-15T22:03:29.337 に答える