使用UIViewAnimation旋转UITableViewCell的UIImageView(我的应用程序挂起!!)

使用UIViewAnimation旋转UITableViewCell的UIImageView(我的应用程序挂起!!),uitableview,uiimageview,rotation,freeze,uiviewanimation,Uitableview,Uiimageview,Rotation,Freeze,Uiviewanimation,我将此UITableViewCell设置在表中,并将left imageView设置为图像。现在,我只想在用户选择单元格(别名行)时连续旋转此图像。我可以设置单元格图像视图的动画以旋转,但一旦我这样做,应用程序就会停止响应用户输入。换句话说,应用程序挂起,图像按应有的方式旋转。下面是相关的代码片段 (void)tableView:(UITableView*)aTableView DidSelectRowatineXpath:(NSIndexPath*)indexPath{ ... [NSThr

我将此UITableViewCell设置在表中,并将left imageView设置为图像。现在,我只想在用户选择单元格(别名行)时连续旋转此图像。我可以设置单元格图像视图的动画以旋转,但一旦我这样做,应用程序就会停止响应用户输入。换句话说,应用程序挂起,图像按应有的方式旋转。下面是相关的代码片段

  • (void)tableView:(UITableView*)aTableView DidSelectRowatineXpath:(NSIndexPath*)indexPath{ ... [NSThread detachNewThreadSelector:@selector(rotateImage)toTarget:self with Object:nil]
。。。。 }

  • (无效)旋转图像{ UITableViewCell*selectedCell=[self.tableView cellForRowAtIndexPath:[self.tableView indexPathForSelectedRow]]

    [UIView beginAnimations:@“循环动画”上下文:nil]; //如果您愿意,这里还有其他动画选项,持续时间可以是任何内容,而不仅仅是3

    [UIView动画持续时间:10延迟:0选项:UIView动画选项重复动画:^{ //在你的图像上,在这个块中,对你将要返回的单元格进行旋转。 selectedCell.imageView.transform=CGAffineTransformMakeRotation(Kdegreestorarians(90)); }完成:无]

    [UIView委员会];
    }

如果我对NSThread代码行进行注释,则应用程序不会挂起,所以基本上我在动画代码中做了一些错误,只是使应用程序处于挂起状态

请帮忙!! TIA

块动画的(恼人的)默认设置是禁用用户交互。试试这个:

[UIView animateWithDuration:10 delay:0
                    options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAllowUserInteraction
                 animations:^{
                    selectedCell.imageView.transform = CGAffineTransformMakeRotation(M_PI);
                }
                 completion:NULL];