【发布时间】:2014-12-14 14:07:11
【问题描述】:
为什么这个 CATransaction 的完成块永远不会触发?
[CATransaction begin];
[CATransaction setCompletionBlock:^{
// table animation has finished
NSLog(@"why does this section never execute?");
}];
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:self.currentFeedItems.count inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
[CATransaction commit];
tableview 动画有效,但从不执行完成块。 Apple 文档说完成块保证会执行。
【问题讨论】:
-
你能告诉我们你在哪里/什么时候打电话,因为它在我这边工作。
-
它被调用以响应按钮按下
-
您能否详细说明您的问题?
-
我最初在表格单元格中设置了一个按钮,并使用委托来让控制器调用上述代码。没用。因此,考虑到它可能与它正在执行的线程有关,我将上面的代码包装在一个 dispatch_async(dispatch_get_main_queue()... 块中。没有工作。所以,我改为使用通知来触发上面的代码。没用。所以...最后我尝试将上面的代码放在控制器本身的一个简单方法中,当 didSelectRowAtIndexPath 触发时,调用此方法。这也不起作用。
标签: ios catransaction