下面的代码将在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不被视为最外层的事务?
发布于 2016-09-05 03:15:27
始终存在隐式事务。也可以有一个显式事务。在所有代码运行完之前,隐式事务不会提交。如果您有一个显式事务(begin和commit),那么当遇到commit时它会提交。
嵌套显式事务的目的只是允许您为动画的不同部分提供不同的参数(例如持续时间);实际提交直到最外层的commit才会发生。读取医生们
只有在提交了对最外层事务的更改之后,核心动画才会开始相关的动画
https://stackoverflow.com/questions/39323399
复制相似问题