我有一个包含很多行的 UITableView。
它就像一个手风琴:http://docs.jquery.com/UI/Accordion http://docs.jquery.com/UI/Accordion主单元有子单元,子单元也有子单元。所以这是一个三层的tableView。
那么,当用户选择一个单元格时,它会使用行动画展开(或折叠)子单元格。
但我需要设置tableView和scrollView的新大小。
我用这个方法做了所有这些事情:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
问题 :
当用户点击一个单元格,然后快速点击一个子单元格时,第二个动画不会完成,因此不会显示第 2 级的子单元格。但大小已经设置(考虑到已经显示了级别 2 的子单元)。
事实上,我正在花时间来处理这个问题……但这真的很糟糕。
这是我的代码示例:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Checking with times (with 0,5 second interval in order to be sure that the previous animation is finished !)
// Setting tableView & scollView heights
[tableView beginUpdates];
if(position.isExpanded == YES)
[tableView reloadRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];
else
[tableView reloadRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationTop];
[tableView endUpdates];
}
所以,我想看这个动画的结尾。
或者,使用一种信号量(但我只有一个进程......)
有什么想法可以解决这个问题吗?
请记住,在您的回复中,我是 iPhone 开发领域的新手。
Thanks.
动画由类的实例控制CAAnimation
。这个类支持一个方法- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
它将被传递给该实例的委托。此信息通常用于了解完成情况。
关于您的特殊要求,我会看看UIView
类参考。有几个任务处理该视图的动画 - 这是UITableView
。因此任何有效的UIView
应该对表视图有影响。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)