Now here’s an extra clever snippet for easily adding a glow effect to an arbitrary view:
We recently needed to add a tutorial to a board game (see SLTutorialController), and realised that we needed a way to highlight various controls and other user interface elements that the user should interact with next. A common way that this is handled is by making things glow, often with an animation.
So, we wrote UIView+Glow. It’s a very simple category that adds two methods: startGlowing and stopGlowing. When you call startGlowing, the view will start to pulse with a soft light; this effect is removed when stopGlowing is called…
Since if you’ve tried to deal with designers’ requests for that kind of thing you’d expect it to be rather image-heavy to say the least, we were intrigued enough to take a look at thesecretlab / UIView-Glow … and why yes, with some applied Core Animation niftiness coupled with objc_setAssociatedObject(), they really do make it just as universally applicable as advertised. Even if you don’t have any use for glows at this exact moment, check out UIView+Glow.m to see a nice clean pattern for adding any type of annotation functionality to arbitrary views!