Iphone 我想在ios中的自定义视图单元上执行动画

Iphone 我想在ios中的自定义视图单元上执行动画,iphone,objective-c,uitableview,uilabel,uibezierpath,Iphone,Objective C,Uitableview,Uilabel,Uibezierpath,我有一个类似于在tableView单元格上录制的要求,它应该设置动画并放置(跳转)到垃圾桶图标 我正在使用UIBezierPath设置文本和跳转功能的动画,但我无法移动tableViewCell中的标签 如有任何想法和建议,将不胜感激 这里检查下面的代码到目前为止我已经做了 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSMutableArray

我有一个类似于在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];
}
-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(nsindepath*)indepath
{
NSMutableArray*视图=[[NSMutableArray alloc]init];
int i=0;
int j=indexPath.row;
UIView*anim=nil;
UIView*vi2;
对于(UIView*目标.superview.subview中的视图)
{
//如果(theview.tag!=2)
//继续;
NSLog(@“%@”,视图);
if([视图是类的种类:[UITableView类]])
{
//NSLog(@“%@”,视图);
UIView*vi=视图;//(UITableView*)[UITableView类];
//NSLog(@“%@”,vi);
//NSMutableArray*视图=[[NSMutableArray alloc]init];
用于(vi.子视图中的UIView*vi1)
{
NSLog(@“当前视图…%@”,vi1);
对于(int k=0;k<[arrayList count];k++)
{
[视图插入对象:vi1 atIndex:i++];
NSLog(@“DDD%@,[视图对象索引:i-1]);
}
}
//vi1=(UITableViewCell*)[tableElements对象索引:i];
anim=(UIView*)[views objectAtIndex:j];
anim=vi2;
对于(int k=0;k<[视图计数];k++)
NSLog(@“元素%d=%@”,k,[views objectAtIndex:k]);
打破
}
}
如果(!anim)
返回;
UIBezierPath*movePath=[UIBezierPath bezierPath];
[移动路径移动点:动画中心];
[movePath addQuadCurveToPoint:destination.center
控制点:CGPointMake(destination.center.x,anim.center.y)];
CAKeyframeAnimation*moveAnim=[CAKeyframeAnimation animationWithKeyPath:@“位置”];
moveAnim.path=movePath.CGPath;
moveAnim.removedOnCompletion=是;
CABasicAnimation*scaleAnim=[CABasicAnimation animationWithKeyPath:@“transform”];
scaleAnim.fromValue=[NSValue ValueWithCatTransformM3d:CatTransformM3DidEntity];
scaleAnim.toValue=[NSValue ValuewithCatTransformM3d:CatTransformM3dMakeScale(0.1,0.1,1.0)];
scaleAnim.removedOnCompletion=是;
CABasicAnimation*opacityAnim=[CABasicAnimation animationWithKeyPath:@“alpha”];
opacityAnim.fromValue=[NSNumber numberWithFloat:1.0];
opacityAnim.toValue=[NSNumber numberWithFloat:0.1];
opacityAnim.removedOnCompletion=是;
CAAnimationGroup*动画组=[CAAnimationGroup动画];
animGroup.animations=[NSArray arrayWithObjects:moveAnim、scaleAnim、opacityAnim、nil];
animGroup.duration=0.5;
[anim.layer addAnimation:animGroup forKey:nil];
}

Arun.

我可以建议您制作单元格的快照,并将其作为UIImageView放在层次结构中的当前主视图中(主要是self.view)。可以按原样从表中删除单元格,但可以为该UIImageView应用动画。当我尝试使用UITableView进行拖放时,我已经完成了这个技巧。

我可以建议您制作单元格快照,并将其作为UIImageView放在层次结构中的当前主视图上(主要是self.view)。可以按原样从表中删除单元格,但可以为该UIImageView应用动画。当我尝试使用UITableView进行拖放时,我已经使用了这个技巧。

欢迎使用stackoverflow!网上最好的网站。欢迎来到stackoverflow!网上最好的网站。