Simple parallax for custom buttons?

I'd like to implement subtle "side-to-side"-style motion on some custom buttons, similar to those in the Settings app, or on the Play or Buy buttons for an iTunes movie. For the life of me, I can't figure out how to get a *simple* parallax effect on a custom button. 😕


Is this even possible if I'm using code (I made a UIButton category) to create the focus animation and shadow effects??

Accepted Answer

You can use a UIMotionEffect to do basic side-to-side animation in response to the remote. Take a look at UIInterpolatingMotionEffect for the API. When your button becomes focused, add the motion effects; when your button loses focus, remove the effect. You should add and remove the effects within an animation block for a smooth transition between the focused and not-focused states.

Got it! Thanks so much! 🙂

Simple parallax for custom buttons?
 
 
Q