Drop me an email if you'd like to hire me (part time) or learn more about what I do. You can read about my experience and references on LinkedIn.
iOS: Using UIMotionEffect to add perspective to a view when tilting device
UIMotionEffect is a class that provides motion-based modifiers for views.
It allows views to react on tilting of a device - nice class that I’ve learned
The documentation about the class is short. It is an abstract class so
you cannot create object of it directly (need to subclass) but Apple provides
two classes that you can use as is - those are UIInterpolatingMotionEffect
In short - you set min and max relative changes of value of a property you select
and when a device is in motion, the system modifies such property and modified
view behaves like icons on the Springboard or alert views, and so on.
Let’s add modifiers which cause shifting view in horizontal and vertical axes:
Simple, isn’t it?
I think next good example is to change transform property of a view’s layer.
This type of motion effect will imitate how Safari tabs behave, each is tilted
and move a bit when device is in motion.
Before adding motion effect you can add some default tilt of to a view to make
it always a bit tilted down.