CATextLayer - how to disable implicit animations?

Rasto

This drives me mad. Whenever I change value of CATextLayer.foregroundColor property the change is animated no matter what I do. For example I have CATextLayer called layer which is sublayer of CALayer superlayer:

layer.removeAllAnimations()
superlayer.removeAllAnimations()
superlayer.actions = ["sublayers" : NSNull()]
CATransaction.begin()
CATransaction.setAnimationDuration(0)
CATransaction.disableActions()
CATransaction.setValue(kCFBooleanTrue, forKey:kCATransactionDisableActions)
layer.actions = ["foregroundColor" : NSNull()]
layer.actions = ["content" : NSNull()]
layer.foregroundColor = layoutTheme.textColor.CGColor
CATransaction.commit()

And it will still animates! Please help, how can I disable the implicit animations?

matt

The problem is that CATransaction.disableActions() does not do what you think it does. You need to say CATransaction.setDisableActions(true).

And then you can get rid of all the other stuff you're saying, as it is pointless. This code alone is sufficient to change the color without animation:

CATransaction.setDisableActions(true)
layer.foregroundColor = UIColor.redColor().CGColor // or whatever

(You can wrap it in a begin()/commit() block if you have some other reason to do so, but there is no need just in order to switch off implicit layer property animation.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

CATextLayer - how to disable implicit animations?

From Dev

How to disable animations in Ubuntu 16.04

From Dev

How to disable all Unity animations?

From Java

How to disable NavigationView push and pop animations

From Dev

How to disable custom animations from click, angular?

From Dev

How to disable all animations in ios simulator

From Dev

How to disable all animations in ios simulator

From Dev

How do I disable Xcode animations?

From Dev

How to disable custom animations from click, angular?

From Dev

How to disable implicit building in packages? {$IMPLICITBUILD}

From Dev

How to disable all implicit conversion of primitive types?

From Dev

How to disable animations in code when running Espresso tests

From Dev

How to disable WowJS animations from occuring more than once?

From Dev

How do I disable div animations onclick() using jQuery?

From Dev

How to disable RecyclerView item decoration drawing for the duration of item animations

From Dev

How to disable/avoid Fragment custom animations after screen rotation

From Dev

How do i disable page transition animations in windows phone 8?

From Dev

How can I disable animations in Firefox when going full screen?

From Dev

Kendo scheduler, disable animations

From Dev

Disable animations in office 365

From Dev

Kendo scheduler, disable animations

From Dev

Disable CSS animations on Firefox

From Dev

How to set system font for CATextLayer()?

From Dev

Is there a way to disable all PrimeFaces animations?

From Dev

Is there a way to disable all animations on ios?

From Dev

Disable Windows animations for a single user

From Dev

Office Outlook, disable GIF animations

From Dev

How to change the text color in a CATextLayer in Swift

From Dev

How to set CATextLayer in video according to frame?

Related Related

  1. 1

    CATextLayer - how to disable implicit animations?

  2. 2

    How to disable animations in Ubuntu 16.04

  3. 3

    How to disable all Unity animations?

  4. 4

    How to disable NavigationView push and pop animations

  5. 5

    How to disable custom animations from click, angular?

  6. 6

    How to disable all animations in ios simulator

  7. 7

    How to disable all animations in ios simulator

  8. 8

    How do I disable Xcode animations?

  9. 9

    How to disable custom animations from click, angular?

  10. 10

    How to disable implicit building in packages? {$IMPLICITBUILD}

  11. 11

    How to disable all implicit conversion of primitive types?

  12. 12

    How to disable animations in code when running Espresso tests

  13. 13

    How to disable WowJS animations from occuring more than once?

  14. 14

    How do I disable div animations onclick() using jQuery?

  15. 15

    How to disable RecyclerView item decoration drawing for the duration of item animations

  16. 16

    How to disable/avoid Fragment custom animations after screen rotation

  17. 17

    How do i disable page transition animations in windows phone 8?

  18. 18

    How can I disable animations in Firefox when going full screen?

  19. 19

    Kendo scheduler, disable animations

  20. 20

    Disable animations in office 365

  21. 21

    Kendo scheduler, disable animations

  22. 22

    Disable CSS animations on Firefox

  23. 23

    How to set system font for CATextLayer()?

  24. 24

    Is there a way to disable all PrimeFaces animations?

  25. 25

    Is there a way to disable all animations on ios?

  26. 26

    Disable Windows animations for a single user

  27. 27

    Office Outlook, disable GIF animations

  28. 28

    How to change the text color in a CATextLayer in Swift

  29. 29

    How to set CATextLayer in video according to frame?

HotTag

Archive