Answer the question
In order to leave comments, you need to log in
How to attach animation to custom button?
habrahabr.ru/post/258107 - From this article, I wanted to make a custom solution by hiding the animation under the hood. After moving the code to the custom button class, the animation does not work either in the -drawRect method or in -laoutSubview. There are solutions where to push the execution so that the animation works out?
Answer the question
In order to leave comments, you need to log in
It all depends on what you want to do and how.
It is possible to add this animation at the moment of setting the image on the button (setImage:forState:/setBackgroundInage:forState)
or at the moment of adding the view to the "scene"
didMoveToSuperview
Animation should definitely not be added to drawRect. laoutSubview there
There is another option to create a separate method (animateMe) and pull it when necessary
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question