The UIResponder
class has methods to detect motion, although they're usually used to detect a shake with the UIEventSubtypeMotionShake
motion constant.
There may be one for detecting when the device is raised, but I can't find one in Apple's documentation so it's probably private (if indeed it exists).
You could try playing around with different values but to bear in mind that if you find one that works and is not referenced in Apple's documentation, it could be subject to change in future versions of iOS.
Alternatively you could use the CoreMotion
framework directly. Take a look at this StackOverflow article for an example of how to use it.