For one of my iOS projects at work, I needed to find a way to animate various labels within a view.
As I don’t want to reinvent the wheel, I decided to search for a library that would do what I needed. I found AnimateLabel. This little lib receives an
NSString and shows them with an animation between each of them. There is a list of all the available animations (top-bottom, bottom-top, fade, etc.).
After some tests, I found out that this library had some little bugs and performance issues. For example, if you show a modal view on top of a view containing an
ATLabel, the NSThread used to animate the messages is still running. So it is clearly a performance issue. More, if you setup the
ATLabel inside your
viewDidAppear/viewWillAppear methods, the animation may crash or even your whole app if you change the number of messages to be animated.
So, I decided to fork the library and make some changes. I added a stopAnimation method that just needs to be called when the view containing the
ATLabel disappears. I changed as well the logic of the
NSThread used to perform the animation and used a custom GCD that allows to use cancelable blocks.
You can download my fork of the library with a fully working example on GitHub! 🙂