1

私は、tableViewセルをテーピングしてアニメーション化し、ゴミ箱アイコンにドロップ(ジャンプ)する必要があるなどの要件があります。

テキストとジャンプ機能をアニメーション化するために使用UIBezierPathしていますが、tableViewCell 内にあるラベルを移動できません。

どんなアイデアや提案も大歓迎です。

ここで、これまでに行った以下のコードを確認してください。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSMutableArray  *views=[[NSMutableArray alloc]init];
    int i=0;
    int j=indexPath.row;
    UIView *anim = nil;
    UIView *vi2;
    for (UIView *theview in destination.superview.subviews) 
    {
//                if (theview.tag != 2)
//                    continue;
        NSLog(@"%@",theview);
        if ([theview isKindOfClass:[UITableView class]]) 
        {
           // NSLog(@"%@",theview);
            UIView *vi= theview;//(UITableView *)[UITableView class];
           // NSLog(@"%@",vi);

           // NSMutableArray  *views=[[NSMutableArray alloc]init];
            for(UIView *vi1 in vi.subviews )
            {
                NSLog(@" the current view....%@",vi1);
                for (int k = 0; k < [arrayList count]; k++)
                {
                    [views insertObject:vi1 atIndex:i++];
                    NSLog(@" ddddd %@",[views objectAtIndex:i-1]);

                }
               }
              //  vi1=(UITableViewCell*)[tableElements objectAtIndex:i];
                anim=(UIView *)[views objectAtIndex:j];
                anim = vi2;   

            for (int k = 0; k < [views count]; k++)
                NSLog (@"Element %d = %@", k, [views objectAtIndex: k]); 



            break;
          }
        }

    if (!anim)
        return;

    UIBezierPath *movePath = [UIBezierPath bezierPath];
    [movePath moveToPoint:anim.center];
    [movePath addQuadCurveToPoint:destination.center
                     controlPoint:CGPointMake(destination.center.x, anim.center.y)];

    CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    moveAnim.path = movePath.CGPath;
    moveAnim.removedOnCompletion = YES;

    CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
    scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
    scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)];
    scaleAnim.removedOnCompletion = YES;

    CABasicAnimation *opacityAnim = [CABasicAnimation animationWithKeyPath:@"alpha"];
    opacityAnim.fromValue = [NSNumber numberWithFloat:1.0];
    opacityAnim.toValue = [NSNumber numberWithFloat:0.1];
    opacityAnim.removedOnCompletion = YES;

    CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    animGroup.animations = [NSArray arrayWithObjects:moveAnim, scaleAnim, opacityAnim, nil];
    animGroup.duration = 0.5;
    [anim.layer addAnimation:animGroup forKey:nil];
}

アルン..

4

1 に答える 1