Gizmodo
Gizmodo

Reputation: 3202

CATransaction : How to Cancel?

I have following transaction on a CALayer:

CATransaction.begin()
CATransaction.setAnimationDuration(2)
 self.myLayer.opacity = 1
CATransaction.commit()

Since the transaction goes on for two seconds, there are moments where I have to cancel/pause. Is this possible?

Upvotes: 0

Views: 1490

Answers (1)

Rashed
Rashed

Reputation: 2425

Add this line of code -

CATransaction.setDisableActions(true)

You can temporarily disable layer actions when changing layer property values by setting the value of the transaction’s CATransactionDisableActions to true

Upvotes: 1

Related Questions