使用UIViewAnimation旋转UITableViewCell的UIImageView(我的应用程序挂起!!)
||
我在将左imageView设置为图像的表中有此UITableViewCell。现在,我想要的是在用户选择单元格(别名行)时连续旋转此图像。我可以为单元格imageView设置动画,以便旋转,但是一旦我这样做,应用程序就会停止响应用户输入。换句话说,应用程序挂起并且图像按原样旋转。以下是相关的代码段。
(void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
...
[NSThread detachNewThreadSelector:@selector(rotateImage)toTarget:self withObject:nil];
....
}
(无效)rotateImage {
UITableViewCell * selectedCell = [self.tableView cellForRowAtIndexPath:[self.tableView indexPathForSelectedRow]];
[UIView beginAnimations:@ \“循环动画\”上下文:无];
//如果需要的话,这里还有其他动画选项,持续时间可以是任意值,而不仅仅是3。
[UIView animateWithDuration:10延迟:0选项:UIViewAnimationOption重复动画:^ {
//在此块中,对要返回的单元格在图像上进行旋转。
selectedCell.imageView.transform = CGAffineTransformMakeRotation(kDegreesToRadians(90));
}完成:无];
[UIView commitAnimations];
}
如果我在NSThread代码行中添加注释,则应用程序不会挂起,因此基本上我在动画代码中做错了一些事情,只是使应用程序进入了挂起状态。
请帮忙!!
TIA
没有找到相关结果
已邀请:
1 个回复
淘圃跺枯替