禁用動畫

CALayer 屬性動畫預設啟用。如果不希望這樣,可以按如下方式禁用它們。

迅速

CATransaction.begin()
CATransaction.setDisableActions(true)

// change layer properties that you don't want to animate

CATransaction.commit()

Objective-C

[CATransaction begin];
[CATransaction setDisableActions:YES];

// change layer properties that you don't want to animate

[CATransaction commit];