Tuesday, April 19, 2016

UIButton with animating colours - new public repo

I recently needed a flashing UIButton, specifically for a record button for a video recorder.  Theres a nice easy way to do animation of such things using UIView, eg :

Unfortunately, with a UIButton, this causes issues.  I found that the button would become slower to respond, and seem sluggish - it just doesnt seem to work well.  So I had to go back to an older method of animation, using a CAAnimation on the layer of the UIButton.

As it took a little fiddling to get this right, I thought I would share the class in a github repo.  Its here :
https://github.com/lukecsmith/LSAnimatingColourButton

And it now uses a CAAnimation that looks like this :


Any feedback or improvement requests welcome.



No comments:

Post a Comment

Social Network with Firebase 3 - Infinitely scrolling UITableView of Firebase Items

Ive already talked about the basics of a Firebase social network project , and adding posts in two other articles. Here I want to explain ...