下面的代码将backgroundColor
在commit
.
[CATransaction begin];
self.view.backgroundColor = [UIColor redColor];
[CATransaction commit];
sleep(5);
但是使用嵌套显式CATransactions
,仅在最外层事务提交时才更新屏幕。
[CATransaction begin];
[CATransaction begin];
self.view.backgroundColor = [UIColor redColor];
[CATransaction commit];
sleep(5);
[CATransaction commit];
所以这很奇怪,因为我们知道 runloop 会在每个循环中创建一个最外层的隐式事务。为什么在提交implicit transaction
时这不被视为最外层事务?explicit transaction